This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
At what point is the object CREATED AT LINE 05 available for garbage collection.
Select most appropriate answer a) At line 5 b) At line 7 c) At line 8 d) At line 10 e) At line 9 f) At line 12
My doubt is the answer option d or e is correct. Kindly help. When the control comes to execute line 09,the anObj object reference started to point to new object SAMPLE.So I am asking is the answer e is correct. [ September 27, 2006: Message edited by: Shiva Mohan ]
if the object has no references from any live thread,then it is eligible for the garbage collection.
when anObj = anObj.toUpperCase(); is executed a new string object will be created and the reference anObj is pointing to it.But the old string doesn't have any references assigned to it. so it is eligible for garbage collection.