C H A P T E R  6

image

Exceptions and Logging

Exceptions are a way of describing exceptional circumstances within a program. They are a way of signaling that something unexpected (exceptional) has happened. For that reason, exceptions are efficient at interrupting the current flow of the program and signaling that there is something that requires attention. As such, programs that judiciously use exceptions benefit from a better control flow and become more robust. Even so, using exceptions indiscriminately can cause performance degradation.

Within Java, exceptions are said to be thrown and caught. Throwing an exception involves telling the code that ...

Get Java 7 Recipes: A Problem-Solution Approach 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.