© Kishori Sharan and Adam L. Davis 2022
K. Sharan, A. L. DavisBeginning Java 17 Fundamentalshttps://doi.org/10.1007/978-1-4842-7307-4_13

13. Exception Handling

Kishori Sharan1   and Adam L. Davis2
(1)
Montgomery, AL, USA
(2)
Oviedo, FL, USA
 
In this chapter, you will learn:
  • 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 difference between checked and unchecked exceptions

  • How to create a new exception type and use it

  • How to use auto-closeable resources using a try-catch-resources block

  • How to access the stack frames of a thread

  • How to get the class name of the caller of a method

All classes in this chapter are a member of a jdojo.exception module, as declared in Listing ...

Get Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 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.