What decides whether an exception is checked or unchecked?
- Name the class on the dividing line.
- What does the compiler force you to do for a checked one that it does not for an unchecked one?
- The dividing line is
RuntimeException. - Anything extending
RuntimeExceptionorErroris unchecked. Everything else underExceptionis checked. - Checked: the compiler refuses to build unless every caller catches it or declares
throws. - Unchecked: the compiler says nothing at all.
- So
extends Exceptiondecides whether the next programmer is allowed to ignore this.