• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finalize doubt

 
Satish Kota
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun API says this in case of finalize() method

If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.


Does termination of finalization mean failure of finalization process. If this is the case will the object be still avialable in the heap or wil it be removed the JVM?
 
Henry Wong
author
Marshal
Pie
Posts: 21023
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satish Kota:

Does termination of finalization mean failure of finalization process. If this is the case will the object be still avialable in the heap or wil it be removed the JVM?


After the finalize() method is called -- either exits normally or by exception -- whether the object will be GC'ed will depend on whether the object is still unreachable. If the object becomes reachable, it will remain on the heap, otherwise it will be garbage collected.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic