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.2 Example: Divide by Zero without Exception Handling
H.3 Example: Handling ArithmeticException
s and InputMismatchException
s
H.4 When to Use Exception Handling
H.7 Stack Unwinding and Obtaining Information from an Exception Object
Get Android How to Program 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.