There are two methods for outputting line breaks in Java: println() method: automatic line wrapping, using System.out.println() call. "\n" escape character: Manually insert newlines, use "\n" in strings.
Outputting newlines in Java
There are two main ways to output newlines in Java:
1. println() method
System.out.println("第一行"); System.out.println("第二行");
2. "\n" escape character
String message = "第一行\n第二行"; System.out.println(message);
Select method
The above is the detailed content of How to implement output line break in java. For more information, please follow other related articles on the PHP Chinese website!