I need help to understand why object c3 and its Wrapper object will not be eligible for GC in the following question:
class CardBoard {
Short story = 200;
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);
//System.out.println(c3);
//System.out.println(c3.story);
c1 = null;
}
}
c3 is indeed set to null so why is it not eligible? (As I understand c2 is not eligible because of return cb; in go()...right?)