What is the difference between NullPointerException and NullReferenceException?
Asked
Active
Viewed 9,051 times
-2
-
3Possible duplicate of [Java: Why aren't NullPointerExceptions called NullReferenceExceptions?](http://stackoverflow.com/questions/101072/java-why-arent-nullpointerexceptions-called-nullreferenceexceptions) – Nov 08 '16 at 13:09
3 Answers
11
There is no NullReferenceException
in Java. It's a .NET class, which is the equivalent of Java's NullPointerException
.

Joe
- 29,416
- 12
- 68
- 88
3
Java using NullPointerException
instead of NullReferenceException
. So there is no NullReferenceException
in Java.

Ugur Tufekci
- 350
- 2
- 13
3
NullPointerException - The Java exception thrown when an application attempts to use null in a case where an object is required.
NullReferenceException - The exception that is thrown when there is an attempt to reference (or use) a null or uninitialized object.
There is no 'NullReferenceException' in Java. Java has an equivalent class 'NullPointerException'.

Sunil Reddy
- 78
- 7