Throwing an Exception back to calling method trickyMethod can have a input exception: public int trickyMethod() throws IOException { int result = readAnotherInt();// read in an int if ( result < 0 ) throw new IOException( bad data ); return result; } //So if result is less than 0, an exception is thrown //Execution goes back to the calling method //which returns null – see previous slide 18
{}