O'Reilly logo

Android How to Program by Paul Deitel, Abbey Deitel, Harvey Deitel

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

H. Exception Handling: A Deeper Look

Objectives

In this appendix you’ll:

• Learn what exceptions are and how they’re handled.

• Understand when to use exception handling.

• Use try blocks to delimit code in which exceptions might occur.

throw exceptions to indicate a problem.

• Use catch blocks to specify exception handlers.

• Use the finally block to release resources.

• Become familiar with the exception class hierarchy.

Outline

H.1 Introduction

H.2 Example: Divide by Zero without Exception Handling

H.3 Example: Handling ArithmeticExceptions and InputMismatchExceptions

H.4 When to Use Exception Handling

H.5 Java Exception Hierarchy

H.6 finally Block

H.7 Stack Unwinding and Obtaining Information from an Exception Object

H.8 Wrap-Up

Self-Review ...

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