The second question in chapter 3:
class CardBoard{
Short story = 5;
CardBoard go(CardBoard cb){
cb = null;
return cb;
}
public static void main(
String[] args){
CardBoard c1 = new CardBoard();
CardBoard c2 = new CardBoard();
CardBoard c3 = c1.go(c2);
c1 = null;
//dostuff
}
The question is: how many objects are eligible for GC when //dostuff is reached.
The answer is: 2; only object (c1) is eligible and its associated Short wrapper object that is also eligible.
My question is: why c3 and cb are not eligible for GC since both of them are null?
Can some one help me with this? Thanks a lot.