public class BettyAck { public static void main(String argv[]){ BettyAck b =new BettyAck(); } public BettyAck() { Integer x = new Integer(10); findOut(x); Integer y = new Integer(99); Integer z = y; z = null; findOut(y); //here } public void findOut(Integer y){ y = null;
} }
Given the following code, how many objects will be eligible for garbage collection on the line with the comment //here
b is a reference variable, reference variables are never eligible for GC.The object created(new BettyAck()) is also not eligible for GC,as it has reference from b.
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Arabinda Das
Greenhorn
Joined: Oct 03, 2008
Posts: 3
posted
0
we have not lost the reference of 'b' object till now. so its not available for GC