O'Reilly logo

Programming with Java by Sunil Patekar, Mahesh Bhave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 19

EXCEPTION HANDLING

An unusual situation may occur sometimes while running the programs. There might be errors and some of them may be fatal. Take a simple case of divide by zero. Older languages give some error message and halt the execution of the program. If the errors are fatal, one cannot do anything about it but if they are non-fatal, the language should allow us to do some damage control exercise. Java provides elegant way of exception handling precisely for this purpose.

19.1 Why Use Exception Handling

One of the most important reasons for handling exception is that when a program terminates abruptly many undesirable things happen. Certain resources, like open files and the World Wide Web (WWW) connection, remain blocked. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required