It's not a secret anymore!*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 37950
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handle and declare as opposed to handle or declare
 
Similar Threads
Question on "Handle Or Declare" rule for Exceptions - K&B book Page 374 (Exam Watch)
Query: Rethrowing the Same Exception - Kathy Sierra
Exception doubt
Exceptions Doubt
Question about handle and Declare, and PageNo 104