In the following code, if the size of the array is larger than 20, I'm trying to remove anything after 20 from the array. In my loop, I have userinput.remove(20 + i); However, I'm getting that it can't find the symbol remove? I'm not sure why it's doing this if the error.add itself is actually working.
userinput is defined earlier in the code
public static void checknames(String[] userinput){
ArrayList<String> error = new ArrayList<String> ();
if(userinput.length > 20){
for(int i=0; i<userinput.length - 20; i++){
error.add(userinput[20 + i]);
userinput.remove(20 + i);}
JOptionPane.showMessageDialog(null, "You can only enter up to 20
employees. \n The following employees exceed this limit." + error);
}
}