In this section, we study Java exceptions, a language construct to process unusual situations and run-time errors. In the process, we will identify the limitations of checked exceptions.
Many production programs have to detect erroneous input, report it to the user, and in some cases recover to handle more input. Since handling erroneous input deviates from the expected flow of program control, Java provides a mechanism called exception handling that is tailored for this purpose. To be more specific, let us consider an example based on the arithmetic expression evaluator from the previous section.