Hi Karen,
When you have a
throws clause that comes with a checked exception in a method signature, you're instructing the compiler that this method
might throw a checked exception. The implication is that every call to this method must either be made inside a guarded region or the caller method must declare the exception in its signature to pass it up the stack. Whether you actually throw an exception inside the method that
throws it, doesn't matter. An illustrating example of why you still need to declare-or-handle the exception from your code is
polymorphism. Consider this code:
doTest() is overridden in Child so as not to throw an Exception. However, polyTest method doesn't "know" which type of object will come in polymorphically. As a result, the guarded region in polyTest is necessary.