When would you prefer to declare an exception rather than handling it in Java?
Posted
by Epitaph
on Stack Overflow
See other posts from Stack Overflow
or by Epitaph
Published on 2010-05-13T16:00:25Z
Indexed on
2010/05/13
16:04 UTC
Read the original article
Hit count: 404
I know we can declare the exception for our method if we want it to be handled by the calling method. This will even allow us to do stuff like write to the OutputStream without wrapping the code in try/catch block if the enclosing method throws IOException.
My question is: Can anyone provide an instance where this is usually done where you'd like the super class to handle the exception instead of the current method?
© Stack Overflow or respective owner