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.

In more detail

Checked exceptions extend Exception but not RuntimeException; IOException is the classic example. They are valuable when the caller can genuinely recover, but costly when every layer just passes them upward, because a storage exception then leaks into service and controller signatures. Translating them at a boundary keeps public contracts stable.

Example

static void read() throws IOException

Related terms

Taught in

References

Certification courses