Hi All,
I have been a regular reader of javaranch. Thanks all for the great work.
Please let me know of some good material for Garbage collection. Also tell
me how this works....question from K&B
QUESTION 1:
X3 x2 = new X3();
X3 x3 = new X3();
X3 x5 = x3;
x3 = x2;
X3 x4 = x3;
x2 = null;
//insert code
what two lines of code inserted independently at line 18 wil make an object eligible for GC.
Ans:
x5 = null;
x5 = x4;
QUESTION 2:
class A {
private B b; ..............//1
void test(){
b=new B();
this.demo(b);
}
void demo(B bb) {
bb = null;
bb = new B();
}
}
When is the B object at 1 eligible for garbage colelction.
Thanks,
Swapna.