This question was taken from Kathy Sierra SCJP 1.6. How many objects are eligible for garbage collections?
According to Kathy Sierra\'s answer, it is C.
C
c3 is null, so there is clearly no Object there eligible for garbage collection.
c3
null
Note that only two CardBoard objects are created, the two on these lines:
CardBoard
CardBoard c1 = new CardBoard(); CardBoard c2 = new CardBoard();
and after the reference juggling, only one of them is without references.