November 2024
Intermediate to advanced
499 pages
12h 13m
English
In many programs, dealing with the unexpected can be more complex than implementing the “happy day” scenarios. Like most modern programming languages, Java has a robust exception-handling mechanism for transferring control from the point of failure to a competent handler. In addition, the assert statement provides a structured and efficient way of expressing internal assumptions. Finally, you will see how to use the logging API to keep a record of the various events, be they routine or suspicious, in the execution of your programs.
The key points of this chapter are:
When you throw an exception, control is transferred to the nearest handler of the exception.
In Java, checked exceptions are ...
Read now
Unlock full access