import java.util.Scanner;public class array {public static void main(String[] args) {Scanner myScanner = new Scanner(System.in);int[] arr = { 1, 2, 3, 4, 5 };do {System.out.println("===========arr当前数组==========");for (int i = 0; i < arr.length; i++) {System.out.print(arr[i] + "\t");}System.out.print("\n");System.out.println("是否继续删除数字元素:y/n");char num = myScanner.next().charAt(0);if (num == 'y') {if (arr.length > 1) {// System.out.println("=====删除后的数组的元素情况=====");int[] delNew = new int[arr.length - 1];for (int i = 0; i < delNew.length; i++) {delNew[i] = arr[i];}arr = delNew;}else {System.out.println("最后一个元素了,不能再缩减了");break;}}else if (num == 'n') {break;}} while (true);System.out.println("你退出了循环~~");} }