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 Thread 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 "Thread" Watch "Thread" New topic
Author

Thread

Neha Sawant
Ranch Hand

Joined: Oct 11, 2001
Posts: 204
Hi
What is the difference between finalize and finalizer method.
Are these same.
And what happens if an exception is thrown during the execution of these methods and is uncaught.
-Neha


nss
Roopa Bagur
Ranch Hand

Joined: Nov 03, 2000
Posts: 267
From what I understand Finalizer is a method category & Finalize belongs to that category. The JVM calls the Finalizers during garbage collection of an object.
According to Bill Brogden's book
"Java objects may use other system resources beside memory, java provides for Finalizer methods."
The Object class defines a do-nothing finalize method but you can override this method to do some clean up before the JVM collects your object.
Hope this helps.. Anybody correct me if I am wrong.
Originally posted by Neha Sawant:
Hi
What is the difference between finalize and finalizer method.
Are these same.
And what happens if an exception is thrown during the execution of these methods and is uncaught.
-Neha

Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Advice: read the API for finalize method.
I think that if a exception is thrown during the execution of finalize by the g.c. the execution of the method stops, but the object is also collected.


SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread