All:
Here's some code:
Here is the result of running this code:
Hello
Hello = Hello
true
false
I'm just simply looking for confirmation of my reason why I think line 4 printed "false". I"m thinking it has something to do with immutable
String objects, and because the following is true (from K&B
SCJP 6, page 430 431)
I'm thinking that on line 1 the println statement resulted in a concatenation of the two string objects in order to complete the println command, however this same oncatenation does not happen in the code on line 4. Is this true? And if true, what will the JVM in fact be comparing the hello String object to, will it be the "Hel" character string alone or the lo String object alone, or something else?
Thank you for your time.
Gary