October 2003
Intermediate to advanced
784 pages
14h 21m
English
If you come from a Visual Basic background, we recommend that you just forget about unstructured exception handling and learn this new approach using the try...catch statement. After you finish reading this appendix, you’ll find the structured approach much better!
Using the try...catch statement is very straightforward. First we decide which code we want the error handler to monitor by placing that code inside the try block. When an exception occurs in the encapsulated code, a control goes to the catch block that handles the exception. A simple template for a try...catch block is shown in Listing A.3.
try { // Place the code that ... |
Read now
Unlock full access