I'm very new to java. I have to make a program in school, but when I try to run this, I get an error. ArrayIndex....... : 0 at line 139, that wil be where I put two * in front. I'm way to tired to find the error myself. I've been working on this the whole day. Thank you!
PS: I'm using a package called easyIO, in case some of you couldn't understand some of the commands.
edit: I finally found it, and it was a small problem. But now I can't make the damn program find what I search for in the Array.
void UtskriftArt() {
In Utskrift = new In();
In søkefil = new In("Fugler.txt");
int i= 0;
int teller = 0;
String[][] ArtArray = new String[teller][4];
for(; i > 0 && !søkefil.endOfFile(); i++){
søkefil.readLine();
teller++;
if(søkefil.endOfFile()){
søkefil.close();
}
}
System.out.print("Hvilken art vil du søke opp og skriv ut obeservasjonsdata for? ");
String ArtSøke = Utskrift.inWord().trim();
String Art = " ";
System.out.println("\t\t" + Art);
for(i = 0; i <= ArtArray.length; i++){
**if(ArtSøke == ArtArray[i][0]){
Art = ArtArray[i][0];
System.out.print(ArtArray[i][1]);
System.out.print("\t" + ArtArray[i][2]);
System.out.println("\t" + ArtArray[i][3]);
}