我尝试检查是否已到达文件末尾,但空字符串的条件不起作用
public void readEquation(String fileName) {
File aFile = new File(fileName);
String line = null;
int cnt = 0;
try {
FileReader reader = new FileReader(aFile);
BufferedReader bufferedReader = new BufferedReader(reader);
while ((line = bufferedReader.readLine()) != null) {
//but line gets null
intoMap(line, cnt);
cnt++;
}
} catch (IOException e1) {
e1.printStackTrace();
}
}