public void sort(int[] scores){
Arrays.sort(scores);
int count=0;
for(int i = scores.length-1;i>=0;i--){
if(scores[i]>100||scores[i]<0){
continue;
}
count++;
if(count<=3){
System.out.println(scores[i]);
}
}
}
Arrays.sort(scores);
int count=0;
for(int i = scores.length-1;i>=0;i--){
if(scores[i]>100||scores[i]<0){
continue;
}
count++;
if(count<=3){
System.out.println(scores[i]);
}
}
}
//完成 main 方法
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
// int count;
int[] scores = {89 , -23 , 64 , 91 , 119 , 52 , 73};
System.out.println("考试成绩前三名为:");
hello.sort(scores);
}
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
// int count;
int[] scores = {89 , -23 , 64 , 91 , 119 , 52 , 73};
System.out.println("考试成绩前三名为:");
hello.sort(scores);
}