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 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.