so whenever i say "new Dozens" it will crreate a Dozen Object, PLUS a instance member like the int in the example
then since "d" reference object "NEW DOZENS()" has pointing two f***n thing the "d" and the "d[1]", which is become null, the line broke and then the DOzen of d and the int object, where left on the blackhole
The statement Dozens[] da = new Dozens[3] creates the first object i.e. a Dozens array (1). The statement da[0] = new Dozens() creates 2 objects i.e. a Dozens object (2) and an int array (3). The statement Dozens d = new Dozens() creates 2 objects i.e. a Dozens object (4) and an int array (5). Total objects created is 5.
The statements d = null and da[1] = null make objects (4) and (5) eligible for GC at line 14. Both statements are necessary or else objects (4) and (5) wont be eligible for GC at line 14.
Ogeh Ikem wrote:The statement Dozens[] da = new Dozens[3] creates the first object i.e. a Dozens array (1). The statement da[0] = new Dozens() creates 2 objects i.e. a Dozens object (2) and an int array (3). The statement Dozens d = new Dozens() creates 2 objects i.e. a Dozens object (4) and an int array (5). Total objects created is 5.
The statements d = null and da[1] = null make objects (4) and (5) eligible for GC at line 14. Both statements are necessary or else objects (4) and (5) wont be eligible for GC at line 14.
THANKS!!! IT REALLY help me alot hearing from you guys!!
In the renaissance, how big were the dinosaurs? Did you have tiny ads?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth