try { throw null; } catch (Exception e) { if (e == null) System.out.println("Exception is NULL"); else System.out.println("Exception is: "+e.toString()); }