다음 코드에서 배열 크기가 20보다 큰 경우 배열에서 20 이후에 아무 것도 제거하려고합니다. 내 루프에서, 나는 userinput.remove (20 + i); 그러나 심볼 제거를 찾을 수 없다는 것을 알고 있습니까? error.add 자체가 실제로 작동하는 경우 왜 이렇게하는지 잘 모르겠습니다.배열 오류에서 요소 제거
UserInput 사용자는 당신은 remove
배열을 호출 할 수 없습니다 이전 코드
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);
}
}