Java if-else-if ladder

This statement allows the user to have multiple options to check for different conditions. Here, if one of the if or else-if condition is true then that part of the code will be executed and rest will be bypassed. if none of the conditions is true then the final else statement at the end will be executed.

Syntax of if-else-if ladder statement:

Example of nested-if statement:

Output: