Ankit Garg wrote:
and after execution of a2.a=null; //Line12 , this happens
Its a2.a=null;
So this should happen
Banu Chowdary wrote:
I am feeling difficulty in Garbage Collection. Can anyone explain me how to proceed to get how many objects are eligible for garbage collection
The way Ankit explained it..........that's exactly the way to go about solving GC questions.
Always draw the objects on paper as they are created and make a cross when their reference is removed in the code.
In such a way, in the end you can see how many objects are left isolated.
If Ankit can do it in the message,
you should be able to do it on paper.......
Practice a lot(on paper). You should do fine after some experience.
Ankit,
You really explain well, such types of questions......on the forum....