I'm trying to find a way to display my intersection of 2 sets of array containing elements. I couldn't find a way to display my intersection
This is a method to find the intersection of arrays
enum Month {
    
    Jan ("Janurary","01"),
    Feb ("Feburary","02"),
    Mar ("March","03"),
    Apr ("April","04"),
    May ("May","05"),
    Jun ("June","06"),
    Jul ("July","07"),
    Aug ("August","08"),
    Sep ("September","09"),
    Oct ("October","10"),
    Nov ("November","11"),
    Dec ("December","12");
    
    private final String day; //day of the month
    private final String date; //name of the date
    
    //enum constructor 
    Month(String date, String day)
    {
        this.date=date;
        this.day=day;
    }
    
    //accessor for field day
    public String getDay() {
        return day;
    }
    //accessor fpr field month
    public String getDate() {
        return date;
    }
}
class Set{
...
...
...     
public void intersection(Set otherSet)
        {
              for(int x=0; x< otherSet.s.size(); x++)
                {
                   if(belongTo(otherSet.s.get(x)))
                   {
                       addElement(otherSet.s.get(x));
                   }
                }
    }
This method is to get a random set of element in a array. 2 different class, class Set have other methods to calculate other stuffs. The main class is to display it
class Test{
   ... 
   ...
   ...
    private static Set getASet()
        {
            //Set s=new Set()   
            Set s=new Set();
            int rand=(int)(Math.random()*12);
            for(int i=0;i<=rand;i++)
            {
                s.addElement(getAnElement());
            }
            return s;
            
        }
}
    private static void intersectionExample() {
            
                Set A=getASet();
                Set B=getASet();
                Set u=new Set();
                u= A.intersection(B);
                System.out.println("Given sets");
                System.out.printf("A={%s}%n", A.toString());
                System.out.printf("B={%s}%n",B.toString());
                System.out.printf("Intersection of A and B = {%s}", u.toString());
            }
 
    