7.5 Exception Handling: Processing the Incorrect Response
An exception indicates a problem that occurs while a program executes. Exception handling helps you create fault-tolerant programs that can resolve (or handle) exceptions. In some cases, this allows a program to continue executing as if no problems were encountered. For example, the StudentPoll
application still displays results (Fig. 7.8), even though one of the responses was out of range. More severe problems might prevent a program from continuing normal execution, instead requiring it to notify the user of the problem, then terminate. When the JVM or a method detects a problem, such as an invalid array index or an invalid method argument, it throws an exception—that is, an exception ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.