A

Admin • 828.03K Points
Coach

Q. What will be the result of: new HashSet<>(Arrays.asList(1,2,2,3))?

  • (A) [1,2,2,3]
  • (B) [1,2,3]
  • (C) [1,2,2]
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 14
  • Filed under category Java
  • Hashtags: Java Set

Explanation by: Admin
HashSet eliminates duplicate elements, so only [1,2,3] remains.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.