Java Programming/Keywords/switch

is a Java keyword.

It is a branching operation, based on a number. The 'number' must be either, , , or primitive type.

Syntax: (  ) {    : ; : ; ...    : ; : ; } When the  value match one of the, then: The statements after the matched label will be executed including the following label's statements, until the end of the block, or until a  keyword is reached.

For example:

The output from the above code is: Case: 3 Execute until break The same code can be written with if-else blocks":

See also:
 * Java Programming/Keywords/if