O'Reilly logo

Java™ for Programmers: Deitel by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

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

13. Exception Handling

Objectives

In this chapter you’ll learn:

• How exception and error handling works.

• To use try, throw and catch to detect, indicate and handle exceptions, respectively.

• To use the finally block to release resources.

• How stack unwinding enables exceptions not caught in one scope to be caught in another scope.

• How stack traces help in debugging.

• How exceptions are arranged in an exception-class hierarchy.

• To declare new exception classes.

• To create chained exceptions that maintain complete stack-trace information.

It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something.

Franklin Delano Roosevelt

O! throw away the worser part of it, And live ...

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