Home  >  Article  >  Java  >  What is the java print output statement?

What is the java print output statement?

青灯夜游
青灯夜游Original
2020-07-21 10:35:558866browse

The print output statements include: print "System.out.println();" with line breaks, print "System.out.print();" without line breaks, and print bytes "System.out.write();" ”, output according to the format “System.out.printf();”.

What is the java print output statement?

There are four types of output statements in Java:

System.out.println(1111);//换行打印
System.out.print(1111);//不换行打印
System.out.write(2222);//字节输出
System.out.printf("%+8.3f\n", 3.14);//按格式输出

System.out.println(); Yes The most commonly used output statement, it will convert the content in parentheses into a string and output it to the output window (console), and wrap the line. When the output is a basic data type, it will be automatically converted into a string. If the output is An object will automatically call the object's toString(); method and output the return value to the console.

System.out.print(); is very similar to the first one. The difference is that there will be a new line after the previous output. , and this command does not wrap after output.

System.out.printf(); This method continues the output method of C language and outputs through formatted text and parameter list.

Recommended tutorial: "java tutorial"

The above is the detailed content of What is the java print output statement?. 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