我无法在文件中的新行中写入字符串,尽管我在字符串末尾添加了“\n”
public void writeEquation(String fileName, String expr) {
File aFile = new File(fileName);
try {
FileWriter writer = new FileWriter(aFile, true);
BufferedWriter buffered = new BufferedWriter(writer);
buffered.write(expr+"\n");
buffered.flush();
buffered.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
错误在哪里?