aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Finalize doubt 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 doubt" Watch "Finalize doubt" New topic
Author

Finalize doubt

Satish Kota
Ranch Hand

Joined: Feb 08, 2006
Posts: 88
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?


SCJP 5.0 77%
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19073
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Finalize doubt