Difference between System.getProperty(quot;line.separatorquot;); and quot;quot;?(System.getProperty(quot;line.separatorquot;);和QUOT;之间的区别QUOT;?)
问题描述
使用Java FX开发GUI时,在写入文件或从Internet获取数据时,我似乎使用System.getProperty("line.separator");
和"
"
得到了不同的结果。基本上有什么不同?
推荐答案
System.getProperty("line.separator")
返回操作系统相关的行分隔符。
"
"
,在Unix上返回"
"
。因此,如果您希望为当前操作系统生成以行结尾的文件,请使用System.getProperty("line.separator")
或使用PrintWriter
编写。
这篇关于System.getProperty(";line.separator";);和";之间的区别 ";?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!