How to output Java string to console screen

Command to display a character string on the console screen

There are two types of instructions to display a character string on the console screen in Java

//Command 1
System.out.print("Hello World!");

//Command 2
System.out.println("Hello World!");

Instruction 1 System.out.print ();

When using System.out.print () ;, there is no line break after the string displayed on the console **

//Example: System.out.print();Hello World!To display two
System.out.print("Hello World!");
System.out.print("Hello World!");

The execution result is as follows.

Hello World!Hello World!

Instruction 2 System.out.println ();

When using System.out.println () ;, ** line breaks are inserted after the character string displayed on the console **

//Example: System.out.println();Hello World!To display two
System.out.println("Hello World!");
System.out.println("Hello World!");

The execution result is as follows.

Hello World!
Hello World!

Summary

Recommended Posts

How to output Java string to console screen
[Java] How to output and write files!
How to color code console output in Eclipse
[Java] How to get and output standard input
How to write Java String # getBytes in Kotlin?
[Java] How to use Map
How to lower java version
[Java] How to use Map
How to uninstall Java 8 (Mac)
Java --How to make JTable
How to input / output IBM mainframe files in Java?
How to use java Optional
How to minimize Java images
How to write java comments
How to use java class
[Java] How to use Optional ②
[Android Studio] [Java] How to fix the screen vertically
[Java] How to use removeAll ()
[Java] How to display Wingdings
How to use String [] args
[Java] How to use string.format
How to use Java Map
How to set Java constants
[Java] How to cut out a character string character by character
[Java] How to erase a specific character from a character string
How to use Java variables
How to convert Java radix
[Java] How to implement multithreading
Output JaCoCo coverage to console
[Java] How to use Optional ①
How to initialize Java array
Input to the Java console
[Java] How to convert a character string from String type to byte type
How to store a string from ArrayList to String in Java (Personal)
[Java] How to use substring to cut out a character string
How to study Java Silver SE 8
How to use Java HttpClient (Get)
Studying Java # 6 (How to write blocks)
[Rails] How to prevent screen transition
[Java] How to update Java on Windows
How to make a Java container
How to use Java HttpClient (Post)
[Java] How to use join method
How to learn JAVA in 7 days
[Processing × Java] How to use variables
[Java] How to create a folder
Log output to file in Java
How to decompile java class files
[Java] How to use LinkedHashMap class
[JavaFX] [Java8] How to use GridPane
How to write Java variable declaration
How to make a splash screen
How to use class methods [Java]
[Java] How to use List [ArrayList]
How to use classes in Java?
How to name variables in Java
How to pass Oracle Java Silver
How to turn Iterator Dojo (Java)
java Eclipse How to debug javaScript
[Processing × Java] How to use arrays
How to make a Java array