X1142: Set Intersection

The method below takes in two sets of integer values called setA and setB. Create a new set of integers, then add any value that is in both setA and setB. You can create either a HashSet or TreeSet.

For example if setA is {2, 4, 6, 8} and setB is {4, 8, 12, 16}, this method should return {4, 8}.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.