wood burning stoves*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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.
 
Consider Paul's rocket mass heater.
 
subject: object finalize method doubt
 
Similar Threads
finalze method
finalize() ?
finalize
finalize() doubt
finalize() ?