Placing objects in pool happens only when we use literal assignments i.e. String s1="String" but not when we use "new" to create object i.e. String s1= new String("String")
Objects from pool are never eligible for GC just because it's managed by pool and have always valid references for it.
Everybody's invited. Except this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter