15:16:06
public static void main(String[] args) {
//数组创建以后长度不变,定义新的数组添加长度
//删除特定下标数组
String[] array1 = new String[]{"a","b","b","c","d"};
//删除第二个b
int key = 2;
String[] array2 = new String[array1.length - 1];
for(int i = 0;i < array1.length -1 ;i++) {
if(i < key) {
array2[i] = array1[i];
}
if(i >= key) {
array2[i] = array1[i + 1];
}
}
System.out.println("array原来的内容是:" + Arrays.toString(array1));
System.out.println("array修改以后的内容是:" + Arrays.toString(array2));
}
16:02:19