為什么運行失敗啊
import java.ntil.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.three(socres);
? ? ? ??
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ? public void three (int []socres){
? ? Arrays.sort(scores);
? ? int first = 0;
? ? for(int i = socres.length - 1 ; i >= 0&&first<=3;i--)
? ? {
? ? if (scores[i]<0||socres[i]>100)
? ? continue;
? ? first++;
? ? System.out.println(scores[i]);
? ??
? ? }
? }? ??
? ? ? ?
}
2019-09-14
import java.ntil.Arrays;//ntil 改為 util
HelloWorld hello = new helloWorld();//helloWorld()改為HelloWorld()
scores? 這個數(shù)組名 有好幾個拼錯了?
2019-10-06
first應(yīng)該小于3吧。。。?