To print any statement in Java, we use the statement: System.out.println()

The message that is to be printed that is placed within the braces.

For example: If we want to print ‘Hi, How are you?’, we will simply write:

System.out.println (“Hi, How are you?”);


Hi, How are you?

Since we are printing a string i.e. a group of characters, we will enclose it within double-inverted quotes.

If you want to print a character, it is to be enclosed within single-inverted quotes. E.g.:  System.out.println(‘C’); Output:  C

When we use System.out.println(), the cursor skips the line and passes the next line after displaying the output.

There is another statement for displaying output: System.out.print()

When we use System.out.print(), the cursor remains in the same line after displaying the result.


CopyRight © 2019

CopyRight © 2019