How many objects are eligible for garbage collection after this for loop? for (int i = 0; i < 10; i++) { q1 = new Q(i); // 1 } I thought it's 10.Can anybody help pl!
What happens after the end of the loop! What's the scope of q1! Hope that helps! Barry! Please don't put ! after every subject! After a qustion use ? not ! !
Nobody can hear you here so don't shout! [ May 11, 2004: Message edited by: Barry Gaunt ]
The question is where is q1 defined? Not where it is initialized or given subsequent values. q1 is clearly defined out side the loop, and as David says, it will still contain a reference to a Q object (new Q(9)) after the loop exits.