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. ...
Get Just Java™ 2 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.