O'Reilly logo

Just Java™ 2 by Peter van der Linden

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

Exceptions

We'll cover the purpose and use of exceptions following this order. The one sentence summary is “Exceptions are like software interrupts—they are generated by error conditions like division by zero, and they divert the flow of control to a place where you have said you will handle this kind of error.

First, we'll look at the basics of:

  • Why exceptions are in the language.

  • What causes an exception (implicitly and explicitly).

Once an exception has occurred, you'll want to know how to take steps to deal with it:

  • How to handle (“catch”) an exception within the method where it was thrown.

  • Handling groups of related exceptions.

You'll also need to know what happens if you do not provide code to handle each type of exception. ...

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