幫我看看是哪出錯了?
public class HelloWorld {
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
int[] scores = {89,-23,64,91,119,52,73};
int score = hello.arrange(scores);
System.out.println("考試成績的前三名為:");
System.out.println(score);
}
public int arrange(int[] score){
Arrays.sort(score);
int j=0;
for(int i = (score.length-1); i>=0; i--){
if(score[i]<=100&&score[i]>=0){
j++;
return score[i];
}
if(j==3) break;
}
}
}
2016-04-10
題目的輸出是讓在定義方法中實現(xiàn),所以定義方法用void類型,直接在方法里將有效的成績println輸出即可