9.3 More About Exception Classes
The buck stops here.
—SIGN ON HARRY S. TRUMAN’S DESK WHILE HE WAS PRESIDENT
In this section, we discuss techniques for using exceptions that go beyond the basics but are still fundamental.
Declaring Exceptions (Passing the Buck)
Sometimes it makes sense to delay handling of an exception. For example, you might have a method whose code throws an exception, but you may not want to catch the exception in that method. Perhaps some programs that use the method should simply end if the exception is thrown, and other programs that use the method should do something else. As a result, you would not know what to do about the exception if you caught it inside the method. In these cases, it makes sense not to catch the ...
Get Java: An Introduction to Problem Solving and Programming, 8th Edition 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.