這樣為什么不可以
public class HelloWorld {
? ? public static void main(String[] args) {
// 定義一個數組,保存五名學生的成績
int[] scores = { 78, 93, 97, 84, 63 };
// 輸出數組中的第二個成績
? ? ? ? int s= scores[1];
System.out.println("數組中的第2個成績為:"+s);
}
}
public class HelloWorld {
? ? public static void main(String[] args) {
// 定義一個數組,保存五名學生的成績
int[] scores = { 78, 93, 97, 84, 63 };
// 輸出數組中的第二個成績
? ? ? ? int s= scores[1];
System.out.println("數組中的第2個成績為:"+s);
}
}
2015-05-16
舉報
2015-10-19
”請檢查代碼中是否匹配:System.out.println("數組中的第2個成績為:" + scores[1] );,再試試!“這是我試過后的提示,這說明是因為系統只是匹配這條語句作為正確與否的標準;所以你是對的;
2015-09-11
在編程軟件上是對的
2015-05-16
這個方法可以的,要是自己寫,然后在自己電腦上肯定能運行,但是你現在是在做作業,老師給的標準代碼不是這個,所以在提交時過不了,
不是這個方法錯誤,而是老師給的標準答案不是這個,
老師也不能把所有可能出現的正確代碼全設為正確答案,以為他也不一定知道會出現多少種方法。