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.