O'Reilly logo

Java SE 7 Programming Essentials by Michael Ernest

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11

Throwing and Catching Exceptions in Java

Perhaps the most important aspect of writing a complete and useful Java program is dealing with exceptions to its intended execution. To paraphrase an old piece of wisdom, a program runs well for just one reason, but it can fail for all sorts of reasons. Writing a solid program has to do with good design and focusing on correct results. Protecting a program from failure has to do with checking every operation that could go sideways and providing a remedy. I’ll discuss how the exception system works in the Java language and the tools at your disposal to implement it.

In this chapter, we’ll cover the following topics:

  • Understanding the role exceptions play
  • Using a try-catch block
  • Understanding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required