Hi I am reviewing for
scjp just want to clarify a question I've encountered regarding eligibility of Garbage Collection.
Here's the code:
When // doStuff is reached, how many objects are eligible for GC?
A. 0
B. 1
C. 2
D. Compilation fails
E. It is not possible to know
F. An exception is thrown at runtime
Answer:
® ✓ C is correct. Only one CardBoard object (c1) is eligible, but it has an associated Short
wrapper object that is also eligible.
®˚ A, B, D, E, and F are incorrect based on the above. (Objective 7.4).
My Question is , in this line CardBoard c3 = c1.go(c2); ====> c3 becomes null right? so should also be eligible for GC?
Thank You in Advance!