I read the API regarding finalize method but i'm unable to understand the following line Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.
Can someone explain what does this exactly mean. As per my understanding the exception will be ignored but the object will not be garbage collected. So, does this mean the object will never be garbage collected?
-Aravind<br />SCJP 5.0 (91%), Preparing for SCBCD.
Well Arvind, if a finalize method throws any exception, then the execution of the finalize method is halted and the object remains eligible for garbage collection. This doesn't mean that it will never be garbage collected. Whenever garbage collection runs again, the object will (actually might) be garbage collected. So basically the exception is ignored and the object is garbage collected. Here's a test program