A

Admin • 802.91K Points
Coach

Q. What happens when you add a duplicate key to a HashMap?

  • (A) It throws an exception
  • (B) It adds a duplicate entry
  • (C) It updates the existing value
  • (D) It ignores the new entry
  • Correct Answer - Option(C)
  • Views: 3
  • Filed under category Java
  • Hashtags: Java Map

Explanation by: Admin
Adding a duplicate key updates the value in HashMap.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.