All Courses
If Else Statement in Java Language

if else statement Java

May 2nd, 2019 Java

if then else statement in java

Syntax:

if (expression 1)
{
……;
}
else
{
…..;
}

Description :

If the expression evaluates to true, the block of statements will be executed, if not else block of statements will be executed.

Example:

if (5<3)
{
System.out.println(“Will not be printed”);
}
else
{
System.out.println(“Will be printed”);
}

Output:

Will be printed
Social Share:

0 responses on "if else statement Java"

Leave a Message

Your email address will not be published. Required fields are marked *