This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Eeceptions" Watch "Eeceptions" New topic


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

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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Eeceptions
It's not a secret anymore!