Java Reference
In-Depth Information
We can illustrate the logic of the general
switch
statement in a flow chart.
:
Each
case
value is notionally compared with the value of an expression. If one matches then the code
for that case is executed and the
break
branches to the first statement after the switch. As we said
earlier, if you don't include the
break
statements, the logic is quite different, as shown next.