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 Throwing Checked Exception Problem 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 "Throwing Checked Exception Problem" Watch "Throwing Checked Exception Problem" New topic
Author

Throwing Checked Exception Problem

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634



compilation fails


Why it is required to throw B as well ??


OCPJP 6.0 93%
OCPJWCD 5.0 98%
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
When you are trying to catch a checked exception there should be atleast one statement in the try block that is capable of throwing that exception, else the compilation fails
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

You can catch the exception in the same hierarchy. You can't mix them, if there are checked exception!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Throwing Checked Exception Problem
 
Similar Threads
JavaCaps Mock Exams
About one Exception quesion,help
Exception
Constructor
Servelt