KEMBAR78
Nested If-Else and Else-If Ladder | PDF
0% found this document useful (0 votes)
46 views2 pages

Nested If-Else and Else-If Ladder

Uploaded by

Sumedh Chaware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Nested If-Else and Else-If Ladder

Uploaded by

Sumedh Chaware
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Nested if-else in Java:

A nested if in java is an if-else


else statementt that is the target of another if
statement. Nested if statements mean an if if-else statement inside another if
statement. Java allow us to nested ifif-else statements within iff statements, i.e,
we can place an if-else statem
statement inside another if statement.

Syntax:

if (condition1)
{
// Executes when condition1 is true
if (condition2)
{
// Executes when condition2 is true
}
}
Flowchart:
else-if ladder in Java:

Here, a user can decidede among multiple options. The Java if statements are
executed from the top down. As soon as one of the conditions controlling the if
is true, the statement associated with that if is executed, and the rest of the
Java else-if ladder is bypassed.
ssed. If none of the conditions are true, then the final
else statement will be executed.

Syntax:

if (condition)
statement;
else if (condition)
statement;
.
.
else
statement;

You might also like