Originally posted by reubin nibuer:
The doStuff() method throws a checked exception, but does not declare the exception in a
throws clause. It would compile if you changed the method declaration to:
void doStuff() throws MyException {
The method someMethod() invokes doStuff(), which throws a checked exception. Therefore, one of two changes could be made to the code to allow it to compile.
(1) The declaration of someMethod() could be changed to
void someMethod () throws MyException { OR
(2) Inside someMethod(), the call to doStuff() could be put inside a try-catch block that would handle the MyException.