Occasionally, users ask questions about solving NullPointerException
s in Java programs and get their questions closed as duplicates of What is a NullPointerException, and how do I fix it? before someone gives an answer.
We should stop doing this.
NullPointerException
is a bug that can be solved much easier with a direct heads-up like "You forgot to initialize foo
before calling foo.bar()
", and this heads-up should be given as an answer instead of a series of comments.