O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

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

Chapter 9: Exception Handling

1. What class is at the top of the exception hierarchy?

Throwable is at the top of the exception hierarchy.

2. Briefly explain how to use try and catch.

The try and catch statements work together. Program statements that you want to monitor for exceptions are contained within a try block. An exception is caught using catch.

3. What is wrong with this fragment?

Image

There is no try block preceding the catch statement.

4. What happens if an exception is not caught?

If an exception is not caught, abnormal program termination results.

5. What is wrong with this fragment?

In the fragment, a superclass catch precedes a subclass ...

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