posted 16 years ago
One thing you might try to do as a learning exercise is to map it out, see what it looks like, and make a determination.
Each time one is created, draw a reference variable pointing to a circle or something representing the object. If it has a reference inside that got set via a constructor, go ahead and make it point to the object that it is set to. Later, when you get to where the class member references are set to point to each other, just draw the arrows. When a reference is nulled just erase or scribble it out. Then, see what is left and think like a "thread". "Do I have any way that I can get to that object? No? Then it is eligible for GC.
DO a couple of these and it will all make sense.
------------------------
Bob
SCJP - 86% - June 11, 2009