/** * ExceptionRunner.java * * This is the main class that uses the ExceptionThrower class and uses the * try/catch exception mechanism to handle exceptions. * * @author Brad Rippe (brippe@fullcoll.edu) * @version 1.0 */ public class ExceptionRunner { /** * This is the runners main method. * @param args - command line arguments */ public static void main(String[] args) { try { ExceptionThrower thrower = new ExceptionThrower(); thrower.throwFirstException(); } catch(MyFirstException e) { System.out.println("Try/Catch 1: " + e.getMessage()); e.printStackTrace(); } try { ExceptionThrower thrower = new ExceptionThrower(); thrower.throwFirstException("MyFirstException: created with the one parameter constructor"); } catch(MyFirstException e) { System.out.println("Try/Catch 2: " + e.getMessage()); e.printStackTrace(); } finally { System.out.println("Fun with Try/Catch!"); } } }