A

Admin • 828.70K Points
Coach

Q. What happens if you pass a null key to `TreeMap`?

  • (A) It stores the key
  • (B) It throws NullPointerException
  • (C) It replaces previous null key
  • (D) It is ignored
  • Correct Answer - Option(B)
  • Views: 9
  • Filed under category Java
  • Hashtags: Java Map

Explanation by: Admin
TreeMap does not allow null keys and throws a NullPointerException if attempted.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.