第1个回答 推荐于2019-10-23
String[] arrays={"1","2","3","5","6"};
String[] tempArr = new String[arrays.length];
int i = 0;
for(String s:arrays){
if(!s.equals("2")){
tempArr[i] = s;
i++;
}
}
for(int j = 0; j < tempArr.length; j++) {
System.out.println(tempArr[j]);
}
// 数组本身是不可以移除元素的 但可以通过中间变量来实现数组的移除本回答被网友采纳