This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Certification Results and the fly likes What are the below exception Statement can any one explain them? 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 » Certification Results
Bookmark "What are the below exception Statement can any one explain them?" Watch "What are the below exception Statement can any one explain them?" New topic
Author

What are the below exception Statement can any one explain them?

Lal Mothi
Greenhorn

Joined: Nov 03, 2007
Posts: 4
Catch (Exception e),
Catch (Error err),

Catch (Throwable t)


D.Mothi Lal
Jitendra Jha
Ranch Hand

Joined: Jan 28, 2007
Posts: 91
There are three Catch statements.As we know that java's Exception handling mechanism is derived from the Throwable interface,so the throwable is at the top of exception hierarchy.it has two subclasses,namely error and exception.we can say that both of these are peer classes.
In your statement,Exceptions of type Exception are handled by Exception catch and of type error will be handled by error catch.
Though java allows catch blocks to be organised in a subclass to superclass order,but i doubt that your code will ever need the throwable catch as all exceptions are handled by the first 2 catch blocks


Jitendra
SCJP1.5
SCWCD1.5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What are the below exception Statement can any one explain them?
 
Similar Threads
Can you throw too many exceptions?
Resume of program
Doubt in Exception Handling.
NaturalLanguageMultiply: Exceptions
DataClient Adapter pattern