The newline characters in java are [\n] and [\r]. The difference between the two is: [\r] means carriage return, [\n] means new line, but both can achieve line breaks. The specific implementation method is: [System.out.print("\n")].
#In java, you can use \n and \r for line breaks.
(Recommended tutorial: java entry program)
The difference between the two is as follows:
1, \r Enter
2, \ n New line
The same thing between the two is: they will cause line breaks.
Commonly used line wrapping methods:
The first method:
System.out.println()
The second method:
System.out.print("\n");
(Video tutorial recommendation: java video tutorial)
Related introduction:
The newline character of the windows platform is/r/n;
The newline character of the linux platform is/n;
The java program will convert the newline characters entered by users on different platforms into the newline characters of a specific system.
You can get the newline character of the current system through the following command:
System.getProperty("line.separator")
The above is the detailed content of What is newline character in java. For more information, please follow other related articles on the PHP Chinese website!