Java nested-if statement1 min read

Nested-if statement allows the user to use if block inside the other if block. And the inner if is executed only if the outer if is true in condition.

nested-if statement

Syntax of nested if statement:

Example of a nested-if statement in Java:

Output:


if-else-if ladder.
switch statement.
if statement.
if…else statement.