Interview practice question
Null checks everywhere
Backend Engineering · OOP and Design Patterns · Intermediate
Your codebase is full of if (x != null) checks and still has frequent NullPointerExceptions. How would you improve this?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Make absence explicit (Optional, nullable types).
- Null object for default behaviour.
- Validate at boundaries, non-null inside.
- Annotations and static analysis.
- Return empty collections, not null.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.