Hi Ranchers...
I need help with K&B page 259, Question 2.
The solution doesn't give me much insight.
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
}
}
Question : when //do stuff is reached, how many objects are eligible for GC??
My doubt: object c3 gets null assigned after call to c1.go(c2), so why not c1 and c3 both are eligible for GC??
please help....
[ May 28, 2006: Message edited by: sab son ]