Originally posted by Anil Kumar Saha:
for the second expression, it will be 22.
inside heap--> 1 String Array object,10 String Objects
inside String Literal pool--> 1 String Array object,10 String Objects.
Correct me if I'm wrong.
You're wrong. The answer is 2.
This
thread appears to have become more complex than is necessary to answer the original question - which has nothing to do with "the pool" (the apparently abstract concept that few understand but many like to talk about).