aspose 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 Java 8 in Action this week in the Java 8 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: 36579
    
  16
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Handle and declare as opposed to handle or declare
 
Similar Threads
Query: Rethrowing the Same Exception - Kathy Sierra
Question on "Handle Or Declare" rule for Exceptions - K&B book Page 374 (Exam Watch)
Exception doubt
Exceptions Doubt
Question about handle and Declare, and PageNo 104