The NullPointerException in Java (often abbreviated as NPE) is a frequently occurring exception in Java. As most of you probably know, it simply means that you (implicitly) try to dereference a pointer that has the special reserved null value.
As it’s a frequently occurring exception every Java programmer must have stumbled upon it at some point in time. It’s simply unavoidable.
So, why this rather trivial introduction? Well, as it seems, some 12 years after the introduction of the Java programming language and thus some 12 years after the introduction of the NullPointerException, it remains an urban myth among some groups of people that Java does not have pointers.
That’s right, some people honestly still think that Java does not have pointers. There have been many discussions about this subject throughout the years (just do a little searching on the internet). The outcome is always the same. Java (of course) does have pointers. Better yet, everything except primitives is handled by a pointer. It’s just not possible to do any arithmetic with them.
So how come this misconception still exists? I can understand that there might have been some confusion when Java was just released, but nearly 12 years later? Don’t those people ever look at the java.lang.NullPointerException and wonder why it says ‘pointer’ ?