I was wondering how the garbage collector in Java deals with the following situation.
Object A has a reference to Object B and Object B has a reference to Object C. The
B has no reference to it so it will be garbage collected first, then it will understand that C has no reference to it, so C will be garbage collected. It is for illustration, Jvm is smart enough to scoop them in one sweep.
B
C