This shows you the differences between two versions of the page.
java:control_structures:switch [2013/04/10 15:47] 94.223.12.247 |
java:control_structures:switch [2024/02/16 01:03] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== switch ====== | ====== switch ====== | ||
- | The switch statement is a multi-select. An expression is evaluated once and compared to constants. In case of equality, the instructions | + | The switch statement is a multi-select control structure. An expression is evaluated once and compared to 'constants'. In case of equality, the 'statements' that come after the 'constant' are processed. In switch 'statements' can only ordinary data types (ie, 'int', 'long', char, short, etc.) can be used. |
- | that come after the constant processed. In switch statements can only ordinal data types (ie, int, long, int, char, etc.) use. | + | |
<code java> | <code java> |