Chapter 10. Exceptions

  • Run-time Internals: The Heap

  • Garbage Collection

  • Run-time Internals: The Stack

  • Exceptions

  • The Assert Statement

  • Further Reading

  • Some Light Relief—Making an Exception for You

When people say “it's the exception that proves the rule” they mean prove in the sense of “test”, as in proving grounds. They also mean exception in the sense of “infringement”. In other words, you're really hearing “it's the infringements that test whether the rule is any good or not”, but never mind that. In Java, the word “exception” relates to an unwanted error condition, and how we recover from it.

In this chapter, we'll cover the purpose of exceptions, what kinds of things cause them, and how to handle them when they happen. We'll ...

Get Just Java™ 2 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.