Java Program to Implement print() and println() Methods With Examples Full Project For Beginners

 

 

Welcome folks today in this blog post we will be implementing print() and println() methods with examples in java. All the full source code of the application is shown below.

 

 

 

 

Get Started

 

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

 

app.py

 

 

Here we will be using print() method to print characters on the same line as shown below

 

 

import java.io.*;

class GFG {
    public static void main(String[] args)
    {

        // The cursor will remain
        // just after the 1
        System.out.print("GfG1");

        // This will be printed
        // just after the GfG2
        System.out.print("GfG2");
    }
}

 

See also  Build a Scientific & Unit Calculator Android App in Java Full Project For Beginners

 

Now we will be using println() method to print characters on different lines as shown below

 

 

import java.io.*;

class GFG {
    public static void main(String[] args)
    {

        // The cursor will after GFG1
        // will at the start
        // of the next line
        System.out.println("GfG1");

        // This will be printed at the
        // start of the next line
        System.out.println("GfG2");
    }
}

Leave a Reply