public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] a = new int[10]; // 控制台输入数组值 for (int i = 0; i < a.length; i++) { System.out.println("请输入第" + (i + 1) + "个数字:"); int num = input.nextInt(); a[i] = num; } // 遍历输出 for (int i : a) { System.out.print(i + "\t"); } System.out.println(); for (int i = 0; i < a.length; i++) { int num = a[0]; if (a[0] > a[i]) { a[0] = a[i]; a[i] = num; } } for (int i : a) { System.out.print(i + "\t"); } } }