READING CHAPTER 8 SECTION 3 "Propagating Exceptions" - *exception thrower* - directly: method that throws an exception - indirectly: method that calls a method that directly or indirectly throws an exception - for a given exception - *exception catcher* - method that contains a matching catch block for a thrown exception - *exception propagator* - method that does not contain a matching catch block for a thrown exception - header must state exception types propagated - reserved word throws - syntax ( {} - otherwise will not compile - unless exception is a runtime exception - makes throws clause optional - method that throws multiple exceptions might be both: one for each exception - stack trace - system keeps a stack of method calls - when an exception is thrown, the system goes down the stack, searching for a catch block - exception catcher can be set to propogate the caught exception - infrequently used - syntax: try { // exception throwing statement: direct or indirect } catch (Exception e) { // handle throw e; // propagate } - if exception is caused because a condition set by a client is violated, propagate the exception up to the client - IllegalArgumentException class - used to throw exceptions for illegal arguments Quick Check 1. It throws an exception and neither catches it nor is declared with the throws clause. 2. The reserved word throw actually causes an exception to be thrown, whereas the reserved word throws is a clause added to a method header that declares that method an exception propagator. 3. First, the method declaration says that the return type is NumberFormatException when it is actually int. Second, it contains a try block without a corresponding catch block.