A switch statement is a control-flow statement that was originally designed to be a short-form alternative to the if-else if-else control-flow statement for certain use cases that involved multiple possible execution paths based on what a given expression evaluates to.
A switch statement consists of a selector expression and a switch block consisting of case labels; the selector expression is evaluated, and the execution path is switched based on which case label matches the result of the evaluation.
Originally switch could only be used as a statement with the traditional case …: label syntax with fall-through semantics. Java 14 added support for the new case …-> label syntax with no fall-through semantics.