Difficulty: Easy
Correct Answer: just after line 7
Explanation:
Introduction / Context:
Determining GC eligibility requires tracking every live reference to an object. Arrays are objects too and can keep other objects alive by holding references in their elements.
Given Data / Assumptions:
o.oa[0].o is later set to null and then oa[0] is set to null.
Concept / Approach:
The Float remains reachable as long as either o or oa[0] holds its reference. It becomes eligible only when both references are removed. Returning o at line 8 returns null (since line 6 set it to null) and thus does not resurrect the object.
Step-by-Step Solution:
o and oa[0]).After line 6: one reference remains (via oa[0]).After line 7: no references remain; the Float is eligible for GC.Line 8 returns o which is null; this does not affect eligibility.
Verification / Alternative check:
Swap the order of lines 6 and 7; eligibility would still occur after the second nulling step.
Why Other Options Are Wrong:
Lines 5 and 6 still leave a live reference; line 8 returns null, not the Float.
Common Pitfalls:
Overlooking references held inside arrays; assuming returning o implies returning the object (it returns null in this code).
Final Answer:
just after line 7
Discussion & Comments