File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


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%|
 
wood burning stoves
 
subject: Throwing Checked Exception Problem