Chapter 12. Exception Handling

A lot can go wrong when a program runs. The user can provide inappropriate input data, a system or network error might occur, or there might simply be a bug in the code that you didn't know was there. Exception handling allows a program to continue running when an exception occurs. The exception is detected and processed in such a way that the program can keep going.

There is no built-in exception handling in Fortran or C. If you want exception handling in these languages, you have to do all the programming work yourself which usually involves a potentially complicated set of if-then statements and error codes. You also have to perform the exception handling where the exception will occur. You can't easily pass the ...

Get Technical Java™: Developing Scientific and Engineering Applications 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.