求大神解答
public class Java8_1 {
public static void main(String[] args){
int[] scores={89,-23,64,91,119,52,73};
Java8_1 hello=new Java8_1();
? ? ? ? hello.show(scores);
}
public void show(int[] scores){
int count=0;
Arrays.sort(scores);
for (int i=scores.length-1;i>=0;i--){
if((scores[i]<0)||(scores[i]>100)){
continue;}
count++;
if (count>3)
{break; ? ? ? ? ? //當(dāng)count>3時(shí),為什么只輸出3個(gè)數(shù)?。縝reak應(yīng)該只跳出本層循環(huán)啊,應(yīng)該還是要打印 ? ? ? ? ? ? ? ? ? ? ? ??。?!
}
System.out.println(scores[i]);
}
}
}
2015-03-19
break跳出的是for循環(huán),不是if