Java tutorial
public class Main { static void aMethod() { try { throw new NullPointerException("demo"); } catch (NullPointerException e) { System.out.println("Caught inside demoproc."); throw e; // rethrow the exception } } public static void main(String args[]) { try { aMethod(); } catch (NullPointerException e) { System.out.println("Recaught: " + e); } } }