A

Admin • 833.24K Points
Coach

Q. What happens if we call `remove(null)` on a HashSet that doesn't contain null?

  • (A) Throws NullPointerException
  • (B) Throws IllegalArgumentException
  • (C) Returns false
  • (D) Removes all elements
  • Correct Answer - Option(C)
  • Views: 26
  • Filed under category Java
  • Hashtags: Java Set

Explanation by: Admin

`remove(null)` returns false if null is not present in the HashSet.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.