posted 16 years ago
An object can only be garbage collected if it cannot be referenced from the "active" part of the program.
So if obj1 is garbage collected, this means it cannot be referenced from the active part of the program. Now, if obj2 could be referenced from the active part of the program, then this would provide a way to reference obj1 from the active part of the program. But we know this is not possible, because obj1 is garbage collected. Therefore, it must be that obj2 cannot be referenced from the active part of the program, and so obj2 is eligible for garbage collection.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org