This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I agree with Abimaran. You can solve these types of questions easily if you draw a diagram of what is happening. I draw usually the given objects in circles and then I draw a arrow pointing to that circle. The arrows thus begins with the reference variable name and ends with the circle which represents the object. Then I delete and move the arrows as the code follows and at the desired line, I count the circles to which there are no arrows pointing to. This is the number of objects eligible for GC. I hope I wrote it understandably :-)
subject: How many Objects are elligible for Gabbage Collection at Line 17?