我有一個字符串數組的問題,程序將使用名稱放在屏幕中。我做了一些編碼和創建2D遊戲和Android應用程序,但事實上我從來沒有使用數組來保存分數或什麼,現在我被卡住了,需要在下面學習它和代碼,想想它,因爲我們把拼貼學生的學位放在錯誤陣列犯錯誤,爲什麼下面的完整代碼,我無法弄清楚:字符串數組錯誤
public static void main(String[] args) {
// TODO Auto-generated method stub
Chatlength = new String[10];
for(i =0; i <= Chatlength.length ; i++){
Scanner s = new Scanner(System.in);
String ss = s.nextLine();
Chatlength[i] = ss;
}
while(true){
if(i > Chatlength.length){
int ints = 0;
while(ints <10){
System.out.println("Name "+ints+": "+Chatlength[ints]);
ints++;
}
}
}
它給了我和誤差Chatlength[i] = ss;
。
嗯*它給了什麼*錯誤?你沒有足夠的時間不是寫一個壞問題的好理由。 –