This week's book giveaway is in the Testing forum. We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line! See this thread for details.
"java" doesn't get destroyed; it's just not referenced anymore. For most objects, that means the garbage collector will eventually delete it. For this particular String, since it's a literal (a String constant that appears in the source code) it's held in the string pool, so it won't be GCd.
String s4 is a new object...so calling == gives false as they are different objects...since s5 is "change me" + words....this creates a new string in the pool...so s1 and s5 refers to different objects in the string pool...s5 is not a constant because of this
Do What You Wanna Be....Taking Things The Way They Come
scjp 1.6 91 percent, scmad 90 percent(rounded off to nearest integer)