Skip to main content

Error-Handling

Checked vs Unchecked Exceptions in Java — A Deep Dive

Every Java developer hits exceptions early. But the difference between checked and unchecked exceptions — and when to use which — trips people up for years. This post goes deep. The Exception Hierarchy # Everything starts from Throwable: Throwable ├── Error (unchecked — don't catch these) │ ├── OutOfMemoryError │ ├── StackOverflowError │ └── ... └── Exception (checked — must handle or declare) ├── IOException ├── SQLException ├── ... └── RuntimeException (unchecked — optional to handle) ├── NullPointerException ├── IllegalArgumentException ├── ArrayIndexOutOfBoundsException └── ... The rule is simple: