When you catch an exception, you do not necessarily have to resolve the problem: You can catch the exception, examine it, and then rethrow it. This is accomplished by catching the exception using a catch block, but in the body of the catch block, throwing the exception using the throw command. The method must declare that it can throw the exception using the throws keyword in the signature of the method. For example:
public void myOtherMethod() throws MyException1 { try { myMethod(); } catch( MyException1 e ) { e.printStackTrace(); throw e; } }
In this example, the call to myMethod() can throw MyException1. If it does, myOtherMethod() catches it, prints its stack trace, and then rethrows it.