int a = 1; a = a / 0; ------------------------------------------- java.lang.ArithmeticException: / by zero
int a = 1; try { a = a / 0; } catch( Exception e ) { System.out.println( e.getMessage() ); }
String a = null; String b = new String(a); ------------------------------------------- java.lang.NullPointerException
String a = null; String b = null; try { b = new String(a); } catch ( Exception e ) { b = ""; }