This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes try catch block Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "try catch block" Watch "try catch block" New topic
Author

try catch block

Chris Cleverley
Greenhorn

Joined: Mar 09, 2007
Posts: 22
Say there is a try block in which an exception is thrown. But the only exception that can be caught is one that is a parent of the exception that is actually thrown.
Will this exception be caught ?
Chris
KN
Ranch Hand

Joined: Aug 13, 2000
Posts: 66
Yes. Whenever you have a catch block which handles a particular exception, then all the exceptions which are the subclasses of that particular Exception are also caught with the same block.
 
Don't get me started about those stupid light bulbs.
 
subject: try catch block
 
Similar Threads
Exception Handling
Try Catch Finally - Voodoo Question
try-catch-final and throw new Exception cert question
Roundup question #132
Benefits of a try... finally only block