February 2013
Intermediate to advanced
672 pages
16h 2m
English
The switch statement transfers control to one of several statements depending on the value of an expression.
SwitchStatement: switch ( Expression ) SwitchBlockSwitchBlock: { SwitchBlockStatementGroupsopt SwitchLabelsopt }SwitchBlockStatementGroups: SwitchBlockStatementGroup SwitchBlockStatementGroups SwitchBlockStatementGroupSwitchBlockStatementGroup: SwitchLabels BlockStatementsSwitchLabels: SwitchLabel SwitchLabels SwitchLabelSwitchLabel: case ConstantExpression : case EnumConstantName : default :EnumConstantName: Identifier
The type of the Expression must be char, byte, short, int, Character, Byte, Short, Integer, String, or an enum type (§8.9), or a compile-time error occurs.
Read now
Unlock full access