// CS 1316 - Jay Summet (GaTech) // Demo simple exception catching. // public class ExceptionDemo { // Instead of catching an exception, you can just say that you throw it. // // public static void main( String [] args) throws java.lang.InterruptedException { public static void main( String [] args) { System.out.println("Starting to run!"); try { Thread.sleep(5000); double q = 1 / 0; } catch ( ArithmeticException e) { System.out.println("I caught an ArithmeticException!" + e); } catch( Exception e) { System.out.println("I caught a generic exception!" + e); } System.out.println("After waiting 5 seconds!"); return ; } }