ファイルから読み取ろうとすると、arrayindexoutofboundsexception が発生するという私の小さな問題があります。私はそれを説明するためのより良い、またはより詳細な方法を知らないので、コードとエラーを以下に貼り付けます。これはすべて、私のプログラムのメインメソッドにあります。
File fila;
String[] innlesningsarray=new String[500];
try{
Scanner innFil=new Scanner(new File("/uio/hume/student-u77/makrist/Downloads/akronymer.txt"));
while(innFil.hasNext()){
for(int i=0; i<500; i++){
// String innLest=br.nextLine();
innlesningsarray=innFil.nextLine().split("\t");
System.out.println(innlesningsarray[i]);
System.out.println(innFil.nextLine());
}
System.out.println("test");
}
System.out.println("Test2");
} catch(Exception e){
System.out.print(e);
}
}
}
この部分の後、頭字語などのオブジェクトがありますが、エラーはありません...
エラー:
AA 自動応答
AAB 全対全ブロードキャスト
java.lang.ArrayIndexOutOfBoundsException: 1