When would you prefer to declare an exception rather than handling it in Java?
- by Epitaph
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?