Which of these exceptions is thrown if an application tries to use `null` in a case where an object is required?

  1. IllegalArgumentException
  2. IOException
  3. NullPointerException
  4. IllegalStateException
Correct answer NullPointerException

Explanation

NullPointerException is thrown when `null` is used where an object is required.

Update: Admin added a tag on this question

Topics

By Admin · · 24 views