ecli[se運行不了
public class HelloWorld { ? ?public static void main(String[] args) { // 定義一個長度為 3 的字符串數組,并賦值初始值 String[] hobbys = { "sports", "game", "movie" }; System.out.println("循環輸出數組中元素的值:"); // 使用循環遍歷數組中的元素 for(int i=0;i<=3;i++) ? ? ? ?System.out.println(String[i+1]); } }為什么是錯誤的
2016-11-24
public class one_four?
{ ? ?
public static void main(String[] args)?
{ // 定義一個長度為 3 的字符串數組,并賦值初始值?
String hobbys[] = { "sports", "game", "movie" };?
System.out.println("循環輸出數組中元素的值:");?
// 使用循環遍歷數組中的元素
for(int i=0;i<3;i++) ? ? ??
{System.out.println(hobbys[i]); }?
}
}
2016-11-24
2016-11-24
你看看吧~那個數組的話好像是0開頭~所以那個不要加1