There's not actually enough information there to tell - it looks like part of the question is missing. It depends what the s() method of A does. If it doesn't save a reference to b then the B object is eligible for garbage collection after line 5. If it saves a copy of the reference in a then it will be eligible after line 6. But it would be entirely possible for it to do something (like saving a copy in a static reference) that would mean the B object is still not eligible at the end of this code.
ohimai anthony
Greenhorn
Joined: Feb 07, 2012
Posts: 13
posted
0
i think because there are two aliases, refferring to the same object, the two ferences have to be nulled or out of scope for the object to be garbage collected.