This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, During finalization of an object, if an exception is raised, the exception is ignored and the object is not garbage collected. IS this stmt true for all types of exceptions(caught/uncaught) or(checked/unchecked). I got a small program to understand this stmt but got confused. can someone help me? -Sanjana [ January 16, 2004: Message edited by: sanjana narayanan ]
from Khalid/Mughal's 1st edition pg 252 The automatic garbage collector calls the finalize method in an object which is eligible for garbage collection before actually destroying the object....A finalizer can catch and throw exceptions like other moethods. However, any exception thrown but not caught by a finalizer when invoked byt the garbage collector is ignored. The finalizer is only called once on an object, regardless of being interrupted by any exception during its execution. In case of finalization failure, the object still remains eligible to be disposed of at the discretion of the garbage collector (unless it has been resurrected).
So, from what I've read above I belive ANY UNCAUGHT exception (checked or unchecked) can cause teh finalization to fail. That being said, I wouldn't stress over this for the exam. Just knowing the basic facts like these should be enough: * uncaught exceptions will be ignored * that the finalize() method is only called once * finalize() methods are not automatically chained. [ January 16, 2004: Message edited by: Jessica Sant ]