Error Handling Code Samples
The Java programming language provides a flexible error handling model.
- ListOfNumbers.java shows how to use a try and catch block to catch exceptions. For supporting information see The Java Tutorial: Handling Errors Using Exceptions.
- ListOfNumbersWOHandler.java demonstrates how the compiler handles runtime and checked exceptions differently. A program must handle checked exceptions, but does not have to handle runtime exceptions. For supporting information see The Java Tutorial: Handling Errors Using Exceptions.