Difference between the methods println() and print()
The println("...") method prints the string "..." and moves the cursor to a new line.
The print("...") method prints the string "...", but does not move the cursor to a new line.
//
Use of Print command
class Print
{
public static void main(String args[])
{
System.out.print(" Hello ");
System.out.print(" Mr. ");
}
}
==========================================================
//
Use of Println command
class Println
{
public static void main(String args[])
{
System.out.println(" Hello ");
System.out.println(" Mr. ");
}
}
==========================================================
// Difference Between Print and Println
class PP
{
public static void main(String args[])
{
System.out.print(" Hello ");
System.out.println(" Mr. ");
System.out.print(" Good ");
System.out.println(" Bad ");
}
}
==========================================================
Search my YouTube channel : SK Skill India
https://www.youtube.com/channel/UC5jDN7E3s-ByUdH3-4YHnKA?view_as=subscriber
No comments:
Post a Comment