4.2: Exceptions in Java and C++
4.2.1: Exceptions in Java
This article article illustrates the Java flow to handle an exception. Java uses 'try' and 'catch' blocks for the code that handles the exception, and a 'throw' keyword used in the method where the exception occurs. There are 4 sections to the reading, each after the first accessed by clicking <next>. Be sure to read each.
There are several design decisions and are addressed in the design activity of the programming process, including what exceptions to handle, where to place the exceptions handlers, the correspondence of try's to 'catches', the nesting of exception handlers, and which methods will have the throw keywords.
Read section 8.3, which is a continuation of the previous sections on correctness and robustness, and elaborates on exceptions in Java.
4.2.2: Exceptions in C++
Read this overview of the role of exceptions generated by the C++ library. This section also covers throw and try/catch concepts.