You are on page 1of 1

import java.lang.* import java.io.

* class ThrowDemo { static void display() { try { throw new NullPointerExeption("throw demo"); } catch(NullpointerException e) { System.out.println("exception caught inside display method"); throw e; } } public static void main(String args[]) { try { display(); } catch(NullPointerException e) { System.out.println("re caught:",+e); } }

You might also like