liveBook · Manning

Null handling

Null handling is the practice of testing whether a value or reference is null or absent before using it and determining how to proceed.

How 2 Manning books explain it

100 Java Mistakes and How to Avoid Them

A null check is a condition that tests whether a reference has the null value.

How it is used
Prevents misleading null checks and reduces unexpected NullPointerException failures in ordinary and concurrent Java code.
How deep it goes
Explains operator precedence, prevention practices, nullability strategies, and atomic queue handling without developing a complete nullability type system.
Examples
Uses faulty string formatting, ArrayList capacity arithmetic, queue polling, ConcurrentMap.merge, and AtomicInteger.updateAndGet examples.
What you can do after
Diagnose/debug with precedence-aware inspection, static analyzers, local null checks, and atomic collection methods.

Read how 100 Java Mistakes and How to Avoid Them explains null handling →

The Art of Code

A null check is a conditional test that determines whether a reference or value is absent before it is accessed.

How it is used
Improves readable, maintainable navigation through data that may be absent.
How deep it goes
Compares nested checks with nullable types, safe navigation, mapping, and fallbacks, but stops short of detailed language semantics.
Examples
Uses product pricing and user-address navigation to contrast nested Java checks with Kotlin and Optional-based alternatives.
What you can do after
Apply null-safe navigation and explicit fallbacks while keeping business intent visible to callers and maintainers.

Read how The Art of Code explains null handling →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.