Timeline for == operator with Strings
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2020 at 9:12 | history | edited | Community Bot |
Commonmark migration
|
|
| Jul 5, 2011 at 13:41 | history | edited | T.J. Crowder | CC BY-SA 3.0 |
Add explanation at the end, and a tiny bit up-front
|
| Jul 5, 2011 at 8:49 | comment | added | T.J. Crowder |
@Ockhams: Glad that helped. Yes, the example in that link is wrong (had the author simply tried it, he/she would have known that), but only because the example uses literals and literals (and other constant string expressions) are automatically interned. The overall point of that post, that strings are objects and so if you want to compare them to see if they have the same characters you use equals rather than ==, is correct. But certainly the example is just plain wrong.
|
|
| Jul 5, 2011 at 8:36 | comment | added | OckhamsRazor | @Crowder also, does that mean that the explanation in this link is wrong? gtothesquare.com/2010/04/19/java-vs-equals | |
| Jul 5, 2011 at 8:12 | vote | accept | OckhamsRazor | ||
| Jul 5, 2011 at 8:04 | history | edited | T.J. Crowder | CC BY-SA 3.0 |
add example
|
| Jul 5, 2011 at 7:58 | history | answered | T.J. Crowder | CC BY-SA 3.0 |