User Program Communication

Print in Java

Printing is used to output text directly to the console.


Syntax
System.out.print("Put your text here!" + variable); //assuming variable is declared
System.out.println("Put your text here!" + variable); //automatically adds a new line

Notes

All non-string variables that can be displayed as a string will be converted to string automatically.

Strings and variables are concatenated using a plus sign.


Example
String name = "Hans";
System.out.println("Hello, " + name + "!"); //Will output Hello, Hans!

See Also
Documentation

Java Docs - Formatting

Add to Slack

< HashSets   |   User Input >

© 2019 SyntaxDB. All Rights Reserved.