A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Sep 01, 2005
Aug 01, 2006 21:36:00
for(int i =0;i<5;i++)
Demo d = new demo();
How many object can be garbage collected at line 1
5 or 4
since even if d is out of scope at line 1
but it is still having reference to object demo??
Joined: Mar 02, 2005
Aug 01, 2006 22:13:00
5 objects will be garbage collected.
Reference is out of scope,meaning at line 1 no reference is for demo object.
rocket mass heater
subject: GC Question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014