Lesson 1 of 616 minModule progress 0%

Module 9: Exceptions, Validation, and Debugging

Exception Types: Checked, Unchecked, and Errors

Understand which problems should be handled, which signal bugs, and which usually mean the runtime is in trouble.

Author

Java Learner Editorial Team

Reviewer

Technical review by Java Learner

Last reviewed

2026-04-17

Java version

Java 25 LTS

How this lesson was prepared: AI-assisted draft, manually edited for clarity, and checked against current Java documentation and runnable examples.

Learning goals

  • Differentiate checked exceptions, unchecked exceptions, and errors
  • Know when callers should be forced to respond
  • Read exception types as design signals

Checked exceptions represent recoverable problems the caller is expected to face: File access, networking, and similar operations often live here.

Unchecked exceptions usually signal programming mistakes: NullPointerException, IllegalArgumentException, and index errors often point to bugs in your code flow or validation.

Errors are different: OutOfMemoryError and similar types usually mean the JVM or environment is in trouble, not that your business logic should catch and continue.

Design takeaway: Choose exception types based on who can realistically fix the problem at the call site.

Runnable examples

Unchecked exceptions often point to programmer mistakes

String name = null;
System.out.println(name.length());

Expected output

Throws NullPointerException at runtime.

Mini exercise

Write down one example of a checked exception and one example of an unchecked exception from your own projects or lessons.

Summary

  • Checked exceptions ask callers to respond.
  • Unchecked exceptions often indicate bad state or bad input handling.
  • Errors are usually not part of normal recovery logic.

Next step

Next, handle exceptions cleanly with `try`, `catch`, and `finally`.

Sources used

Advertisement

Lesson check

Which category most often represents programming mistakes?

Next lesson →