Why Netbeans clears line after carriage return?

public class Test {
    public static void main(String[] args) {
        System.out.println("Hii people\rBye");
    }
}

The output of the above Java program should be Bye people. But it gives the output as Bye in the NetBeans. What is the reason for that?

Upvotes: 4

Views: 252

Answers (1)

user9418148
user9418148

Reputation: 23

https://en.m.wikipedia.org/wiki/Carriage_Return#Computers. This might help. Carriage returns is represented differently on different platforms Although, the carriage return should actually mean returning the caret to the beginning of the line. It is represented differently on different platforms. It is commonly represented with a new line. Since it's the new line character for Mac. It also sometimes represented as just whitespace.

Upvotes: 2

Related Questions