且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Files.write():在文本文件中追加新行

更新时间:2023-12-01 15:35:16

您应该避免使用特定的新行分隔符,例如\ n\\ n取决于操作系统,并支持使用在运行时应用的 System.lineSeparator()常量JVM运行的OS的分隔符。

You should avoid specific new line separators such as "\n" or "\r\n" that depends on the OS and favor the use of the System.lineSeparator() constant that applies at runtime the separator of the OS on which the JVM runs.