Nkumawat Nkumawat - 1 month ago 9
Java Question

NullPointerException and NullReferenceException

What is the difference between NullPointerException and NullReferenceException?

Answer

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