对例题中的Arrays.sort改成降序为什么会出现这样的错误
import java.util.Arrays; public class HelloWorld { public static void main(String[] args) { int [] scores = {78,93,97,84,63}; Arrays.sort(scores); System.out.println("排序后数组中元素的值"); for(int i = scores.length; i>0; i- -) System.out.println(scores[i]); } }
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
at demo.HelloWorld.main(HelloWorld.java:10)