I want to update the console progress status by rewriting the same line, but each printing gets in a new line. I'm using Windows 10 pro, Eclipse IDE, Oracle Java 1.8 and source encoding is UTF-8.
My code:
String message;
ArrayList<String> fileList = new ArrayList();
fileList.add("file1");
fileList.add("file2");
fileList.add("file3");
for (String fileName : fileList) {
message = "Procesing file number: " + fileName;
System.out.print("\r" + message);
}
Console output is (3 different lines):
Procesing file number: file1
Procesing file number: file2
Procesing file number: file3
Why does it System.out.print in a new line as if System.out.println() was used? I have also tried "Character.toChars(13)" and "(char)13" with the very same outcome.