At GC point 2, there are two object eligible for GC (f1 and f2), so, option 2 is not the answer.
Now, GC point 1 comes after GC point 2, and at GC point 1, another object is eligible for GC(the one created by new Fiji()), so, at GC point 1, three objects are eligible for GC.
Well, at point 2 there are no object eligible, because the two objects created in the go() method are still reachable. As soon as the method returns though, they become unreachable.
No, f3 still has a reference to the object that was referenced by f2, and that object's f field references the object that was initially assigned to f1.
f3 refers to f1.f, so f1 is not eligible for gc. Further, f1.f refers to f2, so f2 also is not eligible for gc. So... is it that both options are correct (i.e. no object is eligible for gc at GC point 2)?
Got it. Just ignored the simple fact. Since nothing is returned from the method, all the objects created in the method should be available for GC. Additionally, nothing is persisted in the static field. Thank you guys.
Larsen.
Post by:autobot
A day job? In an office? My worst nightmare! Comfort me tiny ad!
a bit of art, as a gift, the permaculture playing cards