I
ich37
Gast
Hallo,ich habe ein Programm geschrieben, dass einen Art kleines Wörterbuch werden soll,leider habe ich ein Problem, nämlich immer wenn man add 1.word 2.word(siehe quelltext)dann kriege ich eine fehlermeldung :cry:
[schild=1]helft mir! [/schild]
Code:
import java.io.IOException;
public class translate {
public static void main(String[] args) throws IOException {
int number_words_ger=0;
int number_words_eng=0;
String words_eng[]=new String[number_words_eng];
String words_ger[]=new String[number_words_ger];
byte buffer[]=new byte[35];
while(true){
System.out.print("Geben sie einen Befehl ein\r\n>");
int length=System.in.read(buffer);
String entry=new String(buffer,0,length-2);
String[] commands=entry.split(" ");
//System.out.print(entry);
if(entry.equals("exit"))
break;
if(commands[0].equals("exit"))
break;
while(commands[0].equals("add")){
words_ger
[words_ger.length]=
commands[1];
words_eng[words_eng.length]=commands[2];
number_words_eng++;
number_words_ger++;
}
}
}
}