hi, this may b primitive but .....plz help. 1. public void whereEligible(){ 2. Object v = new Object(); 3. Object b; 4. v = null; 5. b = v; 6. } does the variable become elligible immediatly after line 4 because of being nullified OR does it not because of active reference at line 5? thanks.
Lawrence Chettiar
Ranch Hand
Joined: Apr 10, 2003
Posts: 62
posted
0
Well Nadeem, The object which was referenced by variable v is eligible for garbage collection after line 4, what you are using at line 5 is the reference variable and not the object referenced at line 2. Hope this makes things clear.
does the variable become elligible immediatly after line 4
Vairables are not garbage collected its the Object they are refering is collected. So object reffered by v may be garbage collected and not v itself. [ June 04, 2003: Message edited by: Anupam Sinha ]