为什么我的代码没有跳出循环,我要的前三名但是总输出五个
import 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};
System.out.println("考试成绩的前三名为:");
hello.print(scores);
}
public void print(int []scores) {
Arrays.sort(scores);
for(int i = scores.length - 1;i >=0;i--) {
int count = 0;
if(scores[i]<0 || scores[i]> 100){
continue;
}
count ++;
if(count > 3){
break;
}
System.out.println(scores[i]);
}
}
}