Javatpoint Logo
Javatpoint Logo

Java Switch Statement

The Java switch statement executes one statement from multiple conditions. It is like if-else-if ladder statement.

Syntax:

flow of switch statement in java

Example:

Output:

20

Java Switch Statement is fall-through

The java switch statement is fall-through. It means it executes all statement after first match if break statement is not used with switch cases.

Example:

Output:

20
30
Not in 10, 20 or 30
Next TopicJava For Loop




Please Share

facebook twitter google plus pinterest tumbler

Learn Latest Tutorials