Java Genesis

Hints for Chapter 11: Exceptions and Files

Problem 4: more on specific exceptions

Although this problem is not difficult, it is not as simple as it may at first appear. The strategy is to create a try-block that contains first the assignment statement to convert the contents of the numerator text field into an integer, and then contains a try-catch statement for the remainder of the code. That is, we construct a try-catch statement embedded within an outer try block.

Try this before looking at the last hint.

Next Hint