public static void getBooks()throws FileNotFoundException{
Scanner input = new Scanner(bookFile);
String line = input.nextLine();
bookNum = 1;
while (input.hasNextLine()) {
bookNum += 1;
line = input.nextLine();
}
bookarray = new String[3][bookNum];
for (int y = 0; y < bookNum; y++){
bookarray [0][y] = line.substring(0,10);
bookarray [1][y] = line.substring(11,15);
bookarray [2][y] = line.substring(17,18);
line = input.nextLine();
}
}
该程序编译但它给了我一个看起来像这样的错误:线程“主”java.util.NoSuchElementException中的异常:没有找到指向行= input.nextLine()的行;线,我不明白为什么。