Question: --Using Java-- Define two bags of type string. Add some strings to bag1 such as apple, orange or pear. Add some strings to bag2. You
--Using Java--
Define two bags of type string. Add some strings to bag1 such as apple, orange or pear.
Add some strings to bag2. You are going to write a method called intersection that returns a
bag that contains common items between the two bags.
To solve this problem, first start with two bags and display them. Make sure you can display
both bags correctly. Then write a method to check if there is any common items between the
bags at all. So that method should return true or false.Once these work, try to write the intersection method.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
