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.
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.
Related concepts
- safe-call operatoralternative to · A safe-call operator conditionally accesses or invokes an operation through a nullable receiver, producing null when the receiver is null.
- missing valueused by · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
- NullPointerExceptionaddresses · NullPointerException is a Java runtime exception raised when code improperly dereferences or otherwise uses a null reference where an object is required.
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.

