image

CHAPTER

8

Exception Handling

imageooking at Murphy’s Law, “If anything simply cannot go wrong, it will anyway,” you know that you should always prepare yourself for the worst-case scenario. Things don’t always turn out how you expect them to, and if anything can go wrong, it probably will. When this happens in real life, there may not be a remedial solution. Fortunately, in programming, if anything goes wrong, there is always a remedial action for you to take—this is called exception handling. When something goes wrong in your program, you say that an ...

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