大神們幫看下哪里錯了
import java.util.Arrays;
public class HelloWorld {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? int[] scores=new int[] {89,-23,64,91,119,52,73};
? ? ? ? HelloWorld hello=new HelloWorld();
? ? ? ? hello.getSco(scores);?
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ? public void getSco(int[] scores){
? ? ? ? int j=0;
? ? ? ? Arrays.sort(scores);
? ? ? ? System.out.println("考試成績的前三名:");
? ? ? ? for(int i=scores.length-1;i<=0;i--){
? ? ? ? ? ? if(scores[i]<0 || scores[i]>100){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? ? ? j++;
? ? ? ? ? ? if(j>=3){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2016-10-16
for() 循環 ?中 i<=0; 這個條件不對,初值 大于0,執行條件卻要<=0,