Java

else if

The if-else statement is used for testing conditions

It is used for true as well as for false condition

If then Else statement provides two paths

The if block is executed when the condition holds true. When the condition evaluates to false, the statements inside the else block are executed

 

Nested IF

Nested if refers to an if statement within an if statement.

When we write an inner if condition within an outer if condition; then it is referred to as a nested if statement in java.

Nested if is a decision-making statement that works similar to other decision-making statements such as if; else; if..else; etc.

It executes a block of code if the condition written within the if statement is true.

However in the nested-if statement the block of code is placed inside another if block.

And the inner block of code will execute only when the outer condition holds true.

Therefore we use the nested if statement to evaluate more than one condition in a program and return multiple values depending on the test condition.

 

simple if

The Java if statement is used to test the condition.

It checks Boolean condition: true or false.

 

else if

The if-else statement is used for testing conditions

It is used for true as well as for false condition. If then Else statement provides two paths.