DevNotes
Support
Java · 12 chapters

Exception Handling

Checked vs unchecked, try-with-resources, custom exceptions, finally, suppressed exceptions, propagation, overriding rules, best practices and Spring Boot error handling.

CHAPTER 01

Exception Handling Fundamentals

What exceptions are, Error vs Exception, the Throwable hierarchy, stack traces, propagation and the five keywords.

6 min · 8 Q&A · 9 examples
CHAPTER 02

Checked vs Unchecked Exceptions

Compile-time vs runtime checking, why checked exceptions exist, throws, overriding rules and the Spring Boot preference.

6 min · 7 Q&A · 18 examples
CHAPTER 03

try-with-resources

Automatic resource management since Java 7 — AutoCloseable vs Closeable, multiple resources, LIFO closing and the Java 9 form.

7 min · 8 Q&A · 24 examples
CHAPTER 04

Custom Exceptions

Designing meaningful domain exceptions — checked vs unchecked, constructors, exception chaining and Spring Boot handling.

5 min · 8 Q&A · 20 examples
CHAPTER 05

Exception Hierarchy

The full Throwable tree, Error vs Exception vs RuntimeException, catch matching and ordering, polymorphism and multi-catch.

6 min · 8 Q&A · 13 examples
CHAPTER 06

finally Block

Cleanup that always runs — execution order, when finally doesn't run, return and exceptions inside finally, and output-based traps.

6 min · 8 Q&A · 18 examples
CHAPTER 07

Suppressed Exceptions

How try-with-resources keeps the primary exception and attaches cleanup failures — addSuppressed, getSuppressed and cause vs suppressed.

5 min · 8 Q&A · 14 examples
CHAPTER 08

throw vs throws

Throwing vs declaring — JVM behaviour, checked/unchecked rules, re-throwing and wrapping, throw null, constructors and overriding.

6 min · 10 Q&A · 29 examples
CHAPTER 09

Exception Propagation & Stack Unwinding

How exceptions travel up the call stack, how the JVM unwinds frames, checked vs unchecked propagation and translation across Spring layers.

6 min · 9 Q&A · 16 examples
CHAPTER 10

Exception Overriding Rules

Same, narrower or none — never broader. Checked vs unchecked rules for overriding, interfaces, abstract classes and constructors.

6 min · 11 Q&A · 23 examples
CHAPTER 11

Best Practices & Anti-Patterns

Production-ready exception handling — what to catch, where to log, translation, fail-fast, performance and the senior developer checklist.

7 min · 8 Q&A · 21 examples
CHAPTER 12

Exception Handling in Spring Boot

@ExceptionHandler, @ControllerAdvice, custom error bodies, validation errors, ProblemDetail and mapping exceptions to HTTP status codes.

7 min · 9 Q&A · 16 examples