结果正确,这样可以吗?
public class practice {
public static void main(String[] args) {
System.out.println("考试成绩的前三名为:");
int[] num = {89,-23,64,91,119,52,73};
Arrays.sort(num);
int j=0;
for(int i=num.length-1;i>=0;i--){
if (num[i]<0||num[i]>100)
{
continue;
}
j++;
if (j>3) {
break;
}
System.out.println(num[i]);
}
}
}