This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "try catch block" Watch "try catch block" New topic

try catch block

Chris Cleverley

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 ?
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.
I agree. Here's the link:
subject: try catch block
It's not a secret anymore!