Special Offer - Enroll Now and Get 2 Course at ₹25000/- Only Explore Now!

All Courses
if else statement Java

if else statement Java

May 2nd, 2019

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