且构网

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

在控制台上的Windows上的java中打印回车

更新时间:2023-12-04 10:52:22

我有了声明并且在命令中有效提示

I had the statement and it worked in the command prompt

System.out.println("This is Java"+'\r'+"That");

并输出为

That is Java

这意味着它完美无缺。

注意:我在Windows 7中使用JDK 7和简单的记事本运行它。

Note: I run it in Windows 7 with JDK 7 and simple notepad.

这是eclipse的问题,它会将\ r作为新行字符并打印

It is the problem of eclipse, it will take \r as a new line character and will print

This is Java
That

作为输出