Originally posted by Anna Swartz:
When the program reaches line 8, how many of the String objects created in line 5 , are eligible for garbage collection?
I do not understand this explanation, we cannot refer to tmp after line 8. Then why does it still have a reference, and when will it loose it?
Originally posted by Alfred Kemety:
Kathy, I really wonder whether Sun is testing our knowledge of the Java concepts and specifications or if we are totally awake during the exam, I mean what's the point behind having tricky questions that take your attention away from the real objective the question is about and make you look at something else?
The "tricky" questions though, in many cases DO show code that, as I've said before, you would fire someone for writing. However, this experience will come in handy when you work for someone and your job is to fix the code written by the worst Java programmer in the universe.