Chapter 12. Exception Callback

IN THIS CHAPTER

Exceptions can be thrown just about anywhere in a Java program. Methods must declare all of the exceptions they might throw except for RuntimeException and its subclasses. A RuntimeException can occur on just about every line of code (just think of the fact that NullPointerException can be thrown anytime a method is invoked if the object reference is null!).

When an exception occurs and is not immediately caught, it propagates up the call stack until it either is caught by one of the invoking methods, or remains uncaught. For methods called from the main() method, the exception can potentially float all the way back up to main() ...

Get Java Thread Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.