public class A {public static void main(String[] args) {int[] arr = { 1, 2, 5, 23, 64, 9, 87, 99 };// 要求删除23int index = -1;int num = 23;for (int i = 0; i < arr.length; i++) {if (num == arr[i]) {index = i;}}for (int i = index + 1; i < arr.length; i++) {arr[i - 1] = arr[i];}arr[arr.length - 1] = 0;for (int i = 0; i < arr.length; i++) {System.out.print(arr[i] + " ");}}
}// 数组的增删都要定义下标,要判断位置// 不同的是增是从倒数第十个元素从左向右移// 删是把右边的赋值给左边