Nkumawat Nkumawat - 7 months ago 57
Java Question

NullPointerException and NullReferenceException

What is the difference between NullPointerException and NullReferenceException?


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'.