This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
first line creates an object in heap and also adds it to the string constant pool. The second line juss makes s2 point to s1. here s2 will point to the string "abc" in the constant pool and the third line will create a store abc in a new location in the heap.
So in total my guess is "abc" exists at three places 2 in the heap and the other in the string constant pool.
Now my doubt is only about counting the objects.. what should i count 2/3?? my guess is three.
Somebody please reply abt the count and correct me if any mistake !!