/** * ExceptionThrower.java * * This class uses the "MyFirstException" class by throwing the * exception from two methods. The first method, throwFirstException(), * throws the Exception by constructing the Exception with the default * constructor. The second method throws the Exception by using MyFirstException's * one parameter constructor. * * @author Brad Rippe (brippe@fullcoll.edu) * @version 1.0 */ public class ExceptionThrower { /** * This method simply constructs and throws MyFirstException. * @throws MyFirstException - thrown on every method call */ public void throwFirstException() throws MyFirstException { throw new MyFirstException(); } /** * This method simply constructs and throws MyFirstException. * This method uses the one parameter constructor of MyFirstException which * sets the exceptions method to the parameter specifed. * @param message - used to set MyFirstException's message * @throws MyFirstException - thrown on every method call */ public void throwFirstException(String message) throws MyFirstException { throw new MyFirstException(message); } }