Home >Java >javaTutorial >How to enter newline in java

How to enter newline in java

coldplay.xixi
coldplay.xixiOriginal
2020-08-18 11:43:3812266browse

How to enter a newline in java: 1. To change one line, use [System.out.println()]; 2. To change two lines, use [System.out.println("\n\n")] ;3. Change three lines and use [System.out.println("\n\n"\n)].

How to enter newline in java

How to enter newline in java:

First method: use

System.out.println()

This is a new line.

Second type: Use

System.out.print("\n");

This is also a line change.

The first type is similar to the second type. Just, if you want to change two lines, three lines, or multiple lines.

Just use:

System.out.println("\n\n");

Change two lines

Change three lines:

System.out.println("\n\n"\n);

Related learning recommendations:java Basic tutorial

The above is the detailed content of How to enter newline in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use java arrayNext article:How to use java array