Hour 18. Handling Errors in a Program

What You’ll Learn in This Hour:

• How to respond to exceptions in your Java programs

• How to create methods that ignore an exception, leaving it for another class to handle

• How to use methods that cause exceptions

• How to create your own exceptions

Errors, the bugs, blunders, and typos that prevent a program from running correctly, are a natural part of the software development process. “Natural” is probably the kindest word that’s ever been used to describe them. In my own programming, when I can’t find the cause of an elusive error, I use words that would make a gangsta rapper blush.

Some errors are flagged by the compiler and prevent you from creating a class. Others are noted by the interpreter in ...

Get Sams Teach Yourself Java™ in 24 Hours, Sixth Edition 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.