Java: PrintWriter.write 向文本文件中写入换行。

Today I use java to parse a file and get some special content and write the content to another file.
I met a strange problem that when I use pw.writer("/n"); to write a  newline, it failed. I also tried pw.write("/n/r"); but failed again.
I talked with my colleague and fine that:

if you want to write a new line to a plain-text document, the code must be like this:

pw.write("/r/n");

你可能感兴趣的:(Java: PrintWriter.write 向文本文件中写入换行。)