previous | start | next

Answers

  1. The FileReader constructor succeeds, and in is constructed. Then the call in.next() throws a NoSuchElementException, and the try block is aborted. None of the catch clauses match, so none are executed. If none of the enclosing method calls catch the exception, the program terminates.
  2. No–you catch both exception types in the same way, as you can see from the code example on page 558. Recall that IOException is a checked exception and NumberFormatException is an unchecked exception.


previous | start | next