System.getProperty("line.separator");和"之间的区别 "? [英] Difference between System.getProperty("line.separator"); and " "?

查看:136
本文介绍了System.getProperty("line.separator");和"之间的区别 "?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Java FX开发GUI时,在写入文件或从Internet获取数据时,我似乎使用System.getProperty("line.separator");" "得到了不同的结果。基本上有什么不同?

推荐答案

System.getProperty("line.separator")返回操作系统相关的行分隔符。

在Windows上返回" ",在Unix上返回" "。因此,如果您希望为当前操作系统生成以行结尾的文件,请使用System.getProperty("line.separator")或使用PrintWriter编写。

这篇关于System.getProperty("line.separator");和"之间的区别 "?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆