posted 19 years ago
This Question is taken from K&B mock exam
Question: How many objects are eligible for Garbage collection after line 6.
The answer is 1. It says the only object without a reference is the one instantiated in line 4
My question is though the reference variable x2 is assigned to a different object in line 6. We still have the object at line 11 referenced by mx. How does that object becomes eligible for GC?
Thanks,
vijaya
[ August 26, 2004: Message edited by: vijaya dev ]