L4, Synatx of println method, Example for printing Hello, package q10761

The PrintHello class demonstrates printing text to the console.

You will notice that the line, System.out.println("Hello, I am learning Java!"); is responsible for printing the text.

This line is written inside the main method.

Please note that in Java, String literals (i.e. text) must be enclosed in double quotes.

In our case you will notice that the String literal Hello, I am learning Java! is enclosed in double quotes.

See the code and retype the same code.

package q10761 :-

package q10761;
public class PrintHello {
    public static void main(String[] args) {
        System.out.println("Hello, I am learning Java!");

Post a Comment