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 object finalize  method doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "object finalize  method doubt" Watch "object finalize  method doubt" New topic
Author

object finalize method doubt

sambasivarao laghuvarapu
Greenhorn

Joined: Jun 07, 2007
Posts: 9
Hi,
class A{
public void finalize(){
int i=8/0;

}
public static void main(String[] args){
A a=new A();
a=null;
System.gc();
}
}
if the garbage collector call the finalize method.what will happen.please explain.
Gaurav Bhatia
Ranch Hand

Joined: Jan 01, 2007
Posts: 49
As per java documentation,
"Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored."


~Gaurav<br />SCJP5
antonio ciambellari
Greenhorn

Joined: Sep 27, 2007
Posts: 11
The JVM will ignore any exception throw in finalize method.
 
jQuery in Action, 2nd edition
 
subject: object finalize method doubt
 
Similar Threads
finalize() ?
finalze method
finalize() ?
finalize
finalize() doubt