This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes finalize() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finalize()" Watch "finalize()" New topic



Joined: Jun 16, 2001
Posts: 26
finalize() only call one time
so, finalize() can overload?

Michelle<br />SCJP<br />OCP Developer 2, 6/6i
kaushik banerjee
Ranch Hand

Joined: Mar 11, 2001
Posts: 56
u're bang on target . finalize() can be overlaoded but the one with the original signature will be called.
protected void finalize() throes Throwable
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
A finalizer is a method from class Object that any class may OVERRIDE. To OVERLOAD method "finalize()" would be futile since when it is used it MUST have the following signature:
protected void finalize() throws Throwable {
//do finalization stuff
Remember that although the "finalize()" override MAY be called on dead instances of the associated class before the memory occupied by that object is reused, to guarantee that it will be called is to use the method "System.runFinalizersOnExit(}" in the class as well.
Have you checked out Aspose?
subject: finalize()
It's not a secret anymore!