File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finalize()" Watch "finalize()" New topic
Author

finalize()

michelle
Greenhorn

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
HI,
u're bang on target . finalize() can be overlaoded but the one with the original signature will be called.
protected void finalize() throes Throwable
Regards,
Kaushik
Anonymous
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finalize()
 
Similar Threads
Garbage Collection
Finalization Method
Gc question
finally , finalize()
why finalize() can't be defined as private?