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.
And the conclusion everyone found was that literals dont get garbage collected...Altho I was myself not very well convinced of the same... However I had accepted it.. But now this 2nd case (urs) has again made me think, if literals also get garbage collected!
Lets wait and see what everyone else has to say abt it!
The good new is, you're right. The answer should be 0. There are no objects eligible for Garbage Collection in that example. String literals are not eligible for garbage collection and, in that example, that's all you have.
The better new is that this is not on the SCJP exam. You'll have to answer questions about garbage collection, but you won't have to answer questions about Sting literals in terms of garbage collection.