public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("请输入一个大于1小羽等于100的整数"); int integer=sc.nextInt(); int []arr=new int[integer]; for (int i = 0; i < integer; i++) { arr[i]=sc.nextInt(); } Arrays.sort(arr,0,integer+1); for (int i = 0; i <= integer; i++){} System.out.print(arr[integer]); }
出现如下错误
修改后
可正常输出