unchecked exception
An exception type, extending RuntimeException, that the compiler does not force callers to catch or declare.
In more detail
Unchecked exceptions usually signal a programming mistake, invalid input or a broken invariant, such as NullPointerException or IllegalArgumentException. Frameworks like Spring prefer them, and the course translates checked storage failures into a domain-shaped runtime exception. Handling is left to a boundary that can make a sensible decision.
Example
static class StorageFailure extends RuntimeException { }Related terms
- checked exception — An exception type that the compiler forces every caller to either catch or declare with throws, making the failure part of the method's contract.
- exception — An error object a program raises to stop normal flow and report that something went wrong.
- NullPointerException — The unchecked exception thrown when code uses a null reference as if it pointed to an object.
- IllegalArgumentException — The standard unchecked exception for a method argument that is not acceptable, such as a blank identifier or a negative count.
- domain exception — An exception named for a business situation, such as OrderMissing or StorageFailure, rather than for a technical cause.
Taught in
- Checked Versus Unchecked Exceptions — Modern Java: Virtual Threads & High-Throughput Services
- The Cost Of Checked Exceptions — Modern Java: Virtual Threads & High-Throughput Services
- Objects, Nested Classes And Garbage Collection — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Sealed Types, Casts And Pattern Matching — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Checked, Unchecked, Catch And Finally — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Try-With-Resources And Suppressed Exceptions — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep