File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Handle and declare as opposed to handle or declare Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Handle and declare as opposed to handle or declare" Watch "Handle and declare as opposed to handle or declare" New topic
Author

Handle and declare as opposed to handle or declare

Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Hi

Why is it that I have to handle and declare an exception if I am re-throwing it in a catch block as opposed to just handle or declare which is the usual case?


~ Mansukh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40041
    
  28
Look on “or” as meaning, “inclusive or” rather than, “inclusive or”.
Consider that your new Exception which you are throwing is different from that you are catching, so it needs a new declaration.
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Hmm.. That explains it.
 
Don't get me started about those stupid light bulbs.
 
subject: Handle and declare as opposed to handle or declare