Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Usage of Throwable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Usage of Throwable" Watch "Usage of Throwable" New topic
Author

Usage of Throwable

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Hi There,
Can you tell me the usage of Throwable.
What it means here.
protected void finalize() throws Throwable {
System.out.println("Frog finalize");
if(DoBaseFinalization.flag)
super.finalize();
}
Thanks
siva
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2867
    
  11

Throwable is the base class of exceptions and errors that can occur. In this case, it is part of the declaration (throws Throwable) meaning that an exception or error can (but not necessarily will) occur during the call to finalize. This declaration is important, because when an exception occurs in a method, the method stops running, and the exception is passed to the caller of the method. Declaring it gives the calling method a heads up of what may be coming. It can either catch the exception (with a catch block) or declare that it will throw it up to its calling method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Usage of Throwable