TryBugHunt

Java exception exercises

Uncaught runtime exceptions take down production Java services: NullPointerExceptions triggered by unexpected null values or auto-unboxing, array indexing beyond bounds, and silent exception swallowing.

Trace the stack trace, locate the source of the exception, and apply defensive coding practices.

See the 14 exercisesOr follow the 30-day path

The exceptions bugs you will meet

The exercises

Errors you might be searching for

More JavaScript practice by topic

Questions

What is modern Java's approach to null safety?

Use java.util.Optional for return values that may be absent, Objects.requireNonNullElse for fallbacks, and annotations like @NonNull.