CHAPTER 9

image

Exception Handling

In this chapter, you will learn

  • About error handling in Java using exceptions
  • How to use try-catch blocks to handle exceptions
  • How to use finally blocks to clean up resources
  • The different between checked and unchecked exceptions
  • How to create a new exception type and use it in your code
  • How to use auto-closeable resources using a try-catch-resources block
  • How to access the stack frames of a thread

What Is an Exception?

An exception is a condition that may arise during the execution of a Java program when a normal path of execution is not defined. For example, a Java program may encounter a numeric expression that ...

Get Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions 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.