This else if statement works as intended, except after it is finished running it comes to this ConcurrentModificationException error. Im thinking it might be from the for each loop but I am not too sure.
 else if(input == 2){
            System.out.println("Enter a period");
            int periodInput = sc.nextInt();
            System.out.println("Enter the students name (Dont include a space between the first and last name)" );
            String nameInput = sc.next();
            if(periodInput == 3){
                for(Student a: period3){
                    if(a.getName().equals(nameInput)){
                        period3.remove(a);
                        System.out.println(period3);
                    }else{
                        System.out.println("No student was found with this name");
                    }
                }
            }
 
     
     
     
    