08 — Error handling & try/catch
Overview
- Use
try/catchto handle exceptions.finallyruns regardless. - Checked vs unchecked exceptions: checked exceptions must be declared or caught.
- Prefer specific exception types in
catchblocks.
Example: ErrorHandlingExample.java demonstrates try/catch and custom exception handling.