Here's a question from Khalid Mughal's
SCJP book:
How many objects are eligible for garbage collection when control reaches (1) ?
Select the one correct answer:
(a) 0
(b) 5
(c) 10
(d) Hard to say.
My answer was (c) 10.
But the book says the answer is (d) Hard to say. The reasoning is that some of the object's could have been GC'ed when control reaches (1).
I see the point - some objects could have been automatically GC'ed before we explicitly call GC.
My question is that is this a valid way to think about GC questions on the real exam ? I would assume that ten objects will be eligible for GC as soon as the loop ends.