Site icon TestingDocs.com

Write a java program to output two lines

Program Description

Write a Java to print two lines of data. We will use the System.out.println statement.

System.out.println

System.out.println statement prints the string and then terminates the line. The following println statement would print the data on the next line.

Flow chart

 

Java Program

public class JavaDemo { 
    public static void main(String[] args) { 
        System.out.println("Welcome to TestingDocs");
        System.out.println("Java is an Object-oriented language"); 
    } 
}

Program Output

Welcome to TestingDocs
Java is an Object-oriented language

Screenshot

 

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

More information on Java can be found on the official website:

https://www.oracle.com/in/java/

Exit mobile version