换行和回车的用法 由 上集回顾发布于 2020-05-09 18:53:24 Javawindowscarriage-returnlinefeed 收藏 System.out.println("Hello \rWorld"); Output:- world 为什么Hello丢失了,我正在使用Windows。 / r,/ n,/ r / n有何不同? 评论 请 登录后发表观点 小妖、精 2020-05-09 18:53:24 \ r是回车符(CR) \ n为换行(LF) \ r \ n是换行符char的回车 Windows及其之前的DOS使用一对CR和LF字符终止行 \ n UNIX(包括Linux和FreeBSD)仅使用LF字符 OSX还使用单个LF字符(0x0A),但是经典的Mac操作系统使用单个CR字符来换行(0x0D)。 You can read more at Link and from a previously asked StackOverflow Question 点赞 评论 到底啦
\ r是回车符(CR) \ n为换行(LF)
\ r \ n是换行符char的回车 Windows及其之前的DOS使用一对CR和LF字符终止行
\ n UNIX(包括Linux和FreeBSD)仅使用LF字符
OSX还使用单个LF字符(0x0A),但是经典的Mac操作系统使用单个CR字符来换行(0x0D)。
You can read more at Link and from a previously asked StackOverflow Question