成绩最高的前三名怎么得到,?教程里只能求三个有效成绩啊
public static void main(String[] args) { int []score = { 89 , -23 , 64 , 91 , 119 , 52 , 73}; Arrays.sort(score); for (int i=0;i<score.length;i++){ //System.out.print(score[i]+" "); if(score[i]>100||score[i]<0){ score[i]=1; } } Arrays.sort(score); System.out.println(); int count = 1; for (int i=score.length-1;i>score.length-4;i--){ if(score[i]!=1){ System.out.print(score[i]+" "); } } }
哦知道了,已经排序了啊