Print a carriage return in java on windows on console

泪湿孤枕 提交于 2019-12-05 01:23:57

I had the statement and it worked in the command prompt

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

and gives me output as

That is Java

That means it works perfectly.

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

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

This is Java
That

as output

nodakai

By "Windows" you mean cmd.exe? And you want to overwrite to the line you previously output, right? Unfortunately I think you need to invoke this Win32 API somehow in order to achieve it

Maybe other Java gurus can provide better answer ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!