package helloworld;
import java.util.Arrays;
/**
*
* @author Y
*/
public class HelloWorld
{
public static void main(String[] args)
{
int[]scores={89 , -23 , 64 , 91 , 119 , 52 , 73};
HelloWorld hello=new HelloWorld();
hello.put(scores);
}
public void put(int[]score){
Arrays.sort(score);
for(int i=score.length;i>score.length-3;i--)
System.out.print(score[i]);
}
错误:!!
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
at helloworld.HelloWorld.put(HelloWorld.java:25)
at helloworld.HelloWorld.main(HelloWorld.java:18)
C:\Users\123\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
构建失败 (总时间: 3 秒)