A

Admin • 832.27K Points
Coach

Q. What is the output of `new HashSet<>(Arrays.asList(null, null, null))`?

  • (A) [null, null, null]
  • (B) [null]
  • (C) []
  • (D) Compilation error
  • Correct Answer - Option(B)
  • Views: 12
  • Filed under category Java
  • Hashtags: Java Set

Explanation by: Admin

HashSet allows only one null, so the output is a Set with one null value.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.