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;
// do Stuff
} }
When // doStuff is reached, how many objects are eligible for GC?
0
1
2
Compilation fails.
It is not possible to know.
An exception is thrown at runtime
The answer is 2 objects are eligible
C1 and Short
but c3 is also null then wy c3 is not available