錯了???為什么=。=我抄代碼都錯
import java.util.Arrays;? ??
public class HelloWorld {
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ?int[] scores = {89,-23,64,91,119,52,73};
? ? ? ?System.out.println("考試成績的前三名為:");
? ? ? ?HelloWorld hello=new HelloWorld();
? ? ? ?hello.show(scores);
? ? ? ?
? ? ? ?}
? ? ? ? ? ?
? ? ? ?
? ? public void show(int[] scores){
? ? ? ? Arrays.sort(scores);
? ? ? ? int num = 0;
? ? ? ? for (int i=scores.length - 1;i >= 0;i--){
? ? ? ? ? ? if(scores[i] < 0||scores[i] > 100){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ? ? ? num++;
? ? ? ? ? ? if (num > 3){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? }
? ? ? ? ? ??
? ? }? ??
? ??
? ? ? ??
? ? ? ??
}
2019-12-19
可能是類名和你的文件名不一樣。你的文件名是”HelloWorld.java“嗎?
2019-12-15
你有毒,明明沒有問題。跟我說錯了
2019-12-06
第七行:hello.showTop3(scores);