The c3 object is initially zero, so there is no need to recall it, since it never existed in the first place. The garbage collector is designed to remove objects that really exist on the heap.
Otherwise, the link to c2 never dropped, and therefore it will not be fixed. Although it appears that c2 is invalidated in the CardBoard c3 = c1.go(c2); statement CardBoard c3 = c1.go(c2); , this is not true. The c2 reference was passed by value, and although the reference is nullified, there is an existing object reference in the main method. Therefore, it will not be fixed.
This leaves us with c1 , which was explicitly revoked and therefore entitled to collection. However, c1 also contains a link to the Short variable history, which has no inbound links from any other object. This leads to the fact that two objects have the right to clear - one CardBoard object and the built-in Short object.
source share