這網(wǎng)頁的編譯器有問題吧?還是。。。
import java.util.Arrays;
public class HelloWorld {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {??
? ? ? ? int d=3;
? ? ? ? int[] scores ={89,23,64,91,119,52,73};? ? ? ?
? ? ? ? Arrays.sort(scores);
? ? ? ? System.out.prinln("前三名");
? ? ? ? for(int i=0;i>scores.length;i++){
? ? ? ? if(scroes[i]>100 || scroes[i]<0)?
? ? ? ? ? ? ? ?{ ? continue;?? ? ? ? ? ?
? ? ? ? ? ? ? ?};? ? ? ? ??
? ? ? ? ?else ?{
? ? ? ? ? ? ? ? if(d>0){? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ?System.out.println(scores[i]);
? ? ? ? ? ? ? ? ? ? ? ? d--;? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ?}? ? ? ? ?
? ? ? ? ? ? ? ?}? ? ?
? ? }
? ???//定義方法完成成績排序并輸出前三名的功
? ?}
}
然后報錯:
error:?'else'?without?'if' else?{ ^ 1?error
2015-04-04
工具報錯異常的幾率很小的。他說else缺少if,那肯定是else語句前面沒有if語句了。仔細看看你的代碼,if語句已經(jīng)用“;”號結(jié)束了,然后else自己就冒出來了,肯定是錯了呀。
2015-04-07
嘿嘿,是嘞