Welcome Learner today in this blog post we will be implementing print() & println() methods BY Demo in java. All the Complete source code of the application is shown Down.
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 doingprint()
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");
}
}
Now we will be doing 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");
}
}