This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Mock Exam Errata and the fly likes finalize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "finalize" Watch "finalize" New topic
Author

finalize

hari kumar
Greenhorn

Joined: May 14, 2001
Posts: 1
1.if I catch an exception in the finalize method, then the object will be garbage collected?
2.if I don't catch the exception thrown in finalize() then the object is not garbage collected, but remains elligible for garbage collection?
Are these stmts T?
Pls explain
Umesh Joglekar
Greenhorn

Joined: May 02, 2001
Posts: 16
Here is a quote from M & R
"A finalizer can catch and throw exceptions like other methods. However, any exception thrown but not caught by the finalizer when invoked by the garbage collector is ignored. The finalizer is only called once on an object, regrdless 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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finalize
 
Similar Threads
Reg. finalize
Exception in finalize()
If a Runtime Exception is thrown in the finalize method -
Garbage Collection
Q on finalize() method