【发布时间】:2011-03-31 02:04:03
【问题描述】:
所以,我有以下代码要写入文件:
Formatter output = ....... // Creating the formatter works, writes to appropriate file.
output.format("%d\n", records.length);
for(GradeRecord gR:records)
{
output.format(gR.toString() + "\n");
}
唯一的问题是,输出没有换行符。
如果我将“\n”替换为“\r”也不起作用。
...我不知道为什么这不起作用。输出已创建并正确写入。 (我看到创建的文件和所有内容都写在其中,除了换行符。)
【问题讨论】:
标签: java file io newline formatter