package com.imooc;
mport java.util.Arrays;
public class HelloWorld {
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
int[] scores = {89 , -23 , 64 , 91 , 119 , 52 , 73};
hello.getBestThree(scores);
}
//定义方法完成成绩排序并输出前三名的功能
public void getBestThree(int[] scores){
Arrays.sort(scores);
int num=0;
for(int i=scores.length -1 ;i--) {
if(scores[i]<0||scores[i]>100) {
continue;
}
num++;
if(num>3) {
break;
}
System.out.println(score[i]);
}
}
}
编译后问题:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at com.imooc.HelloWorld.main(HelloWorld.java:5)
慕雪5558698
相关分类