Java Print Condition – Display Message

 

Java Print Condition :

In every programming language we will try to print statements, values and what ever it might be to display.In java we use System.out.print.

In previous tutorials we have used the statement multiple time and here we have different way of executing this statement

 

System.out.print:

This condition will print a statement and make cursor available  in the same line

 

System.out.print("Cursor is in same line");

 

Java Print Condition

 

System.out.println:

This condition will print the statement and will move to next line.

System.out.println("Cursor moved to next line");

 

You can find the cursor even in output.

Java Print Condition

 

Update Statement:

I have two variables

public static int num = 1;
public static String message = "Welcome";

 

Now i want to print these two variables and also want to provide some additional information

System.out.println(" int : "+num+"   String : "+message);

 

Java Print Condition

 

 

Multi-Line Output:

Some times we need to print values in multiple lines to provide a better readability.

System.out.println(" int variable --> "+num+"\n String variable -->"+message);

 

Java Print Condition

 

In this tutorial on Java Print Condition do let us know in the comment section below.

Do like and share for more interesting tutorials.

 

Show Buttons
Hide Buttons