A

Admin • 833K Points
Coach

Q. Which method is used to find if two sets have any common elements?

  • (A) retainAll()
  • (B) removeAll()
  • (C) containsAll()
  • (D) intersect()
  • Correct Answer - Option(A)
  • Views: 23
  • Filed under category Java
  • Hashtags: Java Set

Explanation by: Admin

retainAll() retains only common elements between the two sets.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.