Given the code. Which line of code marks the earliest point that an object referenced by myInt becomes a candidate for garbage collection?
A) Line 4
B) Line 5
C) Line 6
D) Line 7 Correct answer:7 i think answer should be line 4
because
first, myint---->new Integer(0) //first object
then
myint------>new Integer(1)
so on till ----> new Integer(4)
so after first object would be eligible for GC line 4
OCPJP 6.0 93%
OCPJWCD 5.0 98%
Neha Daga
Ranch Hand
Joined: Oct 30, 2009
Posts: 504
posted
0
after line 4 myint is assigned to arr[i] at line 5 so object reffered by myint has another reference at line 5 and hence it cant be GCed until the method has completed.