java.lang.NullPointerException: Java Beginner
This question already has an answer here:
Probably you have less than 652 lines. file.readLine() returns null when there is no more line to read.
Use your debugger and check the variable 'file'. NullPointerException will be thrown when your variable is null and you try to call function from the null variable.
Most likely you're calling
file.readLine().split()
after the end of the file, so file.readLine() is null.
You could wrap the line in a null check - something like the following:
String[] row;
String[] rawRow = file.readLine();
if (rawRow != null) {
row = rawRow.split(" ");
} else {
break;
}
链接地址: http://www.djcxy.com/p/76196.html