• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread

 
Neha Sawant
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Roopa Bagur
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic