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.
is the object originally referenced by s1 available for garbage collection?
According to me, s1 is not available for garbage collection. Only string s2 is availabe. Its because s1 is being referred from the pool. I have a code which i would like to discuss with u all:
This code gives varied output as u know everytime u run, but i have observed that output generated at line 1 is same as line 3. But this is not the case with line 2 and line 4. Does this gives us an idea that still "Ranch" is still being referred? and if thats the case then it means that "Ranch" is being referred from the pool.