Which exception occurs when accessing a method on a null reference?

  1. NullMethodException
  2. NullAccessException
  3. NullPointerException
  4. IllegalStateException
Correct answer NullPointerException

Explanation

Accessing a method on a null object throws NullPointerException.

Update: Admin added a tag on this question

Topics

By Admin · · 29 views