Standard output is what we use to print out to a console window from within a Java program. Since Java is an object oriented language, almost everything exists inside a class. Accessing the standard output is no different. However, using the standard output does not required a complete understanding of the underlying class structure.
General syntax for printing to standard output and ending with a new line:
General syntax for printing to standard output and remaining on the same line:
Standard Java spacing:
There should never be a space between print or println and the opening parenthesis, because these are method calls that should be firmly attached to the argument list inside the parentheses. Also, it is standard Java convention not to add any space on either side of any parenthesis unless required by the adjacent item.
Your turn! Open your Java IDE of choice. (We recommend InteliJ IDEA .)
Create a Java program that outputs some information about yourself to the console. Try using both print and println statements. Try outputting some values without quotation marks around them, incorporating them into your narrative.
Create some console art of your own. Experiment with print and println statements and with escape sequences like \”, \n, and \\.
Sign in to submit your projects for evaluation, take the online completion quiz, notify an instructor of your accomplishment, or apply your work to stream certificates.