代碼出錯 運行不出來不 大神幫忙指點下
import java.util.Arrays;
public class HelloWorld {
? ?
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? HelloWorld hello=new HelloWorld();?
? ? ? ? int[] scores={89,-23,64,91,119,52,73};
? ? ? ? hello.t(scores);
? ? ? ??
? ? ? ??
? ? ? ??
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ? public void t(int[] scores){
? ? ? ? System.out.println("考試成績的前三名為:");
? ? ? ? Arrays.sort(scores);
? ? ? ? int j=0;
? ? ? ? for(int i=scores.length-1;i>=0;i++){
? ? ? ? ? ? if(scores[i]>0&&scores[i]<100){
? ? ? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? ? ? ? ? j++;
? ? ? ? ? ? ? ? while(j>2)
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }
? ? ? ??
? ? ? ? }
? ? }
}
2018-08-08
i++改成i--
2018-08-09
一、
i++改成i--
二、
&&? 這個改成 ||
&&是與的意思。
||是或的意思。