Java tutorial
/* * Output: * * recaught: java.lang.NullPointerException: demo * */ public class MainClass { public static void main(String args[]) { try { throw new NullPointerException("demo"); } catch (NullPointerException e) { System.out.println("recaught: " + e); e.printStackTrace(); } } }