Originally posted by srinivas sridaragaddi:
Hi,
I thought both newestname and name both are eligible but only name is eligible for collection. Does it mean that only explicitly null assigned strings are eligible for garbage collection.
Please explain.....
Hi Srinivas,
newestName is not eligible because it has its reference pointing to the name
String Object, not null. To take it a step farther, name is not eligible for GC either because it has a reference from newestName. Assigning newestName to null will make them both eligible.
Hope this helps...
Aloha,
Doug