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 Eeceptions 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 "Eeceptions" Watch "Eeceptions" New topic
Author

Eeceptions

amrit singh
Ranch Hand

Joined: Nov 03, 2000
Posts: 42
Hi all !!!
when catching multiple exception the class hierarchy of exception is imortant i mean more specific must come b4
is this also true when we declare in throws statement
steve richardson
Greenhorn

Joined: Dec 16, 2000
Posts: 3
No, when a method is declared to throw a number of Exceptions, there is no requirement to list these in any particular order of precedence. Generally though, you should try and throw as specifically as you can to help the client programmer and make the code cleaner and easier to read. On the other hand, though, if you have a method that throws five different exceptions that are all, say, sub-classes of IOException, it is better to simply say throws IOException, and then to catch the specific sub-classes in the calling code. Hope this is of some use.
Regards,
Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eeceptions