The switch statement can deal with specific values for the control variable. Typically we can use integers or enumerated types.
See also: Boxes tutorial
See also: if .. else ..
See also: if .. else .. if ..
1. [ Java ] switch .. case
We calculate the population density in people per 100km2.
- Notice that each case requires the
break - Notice that cases 2 and 3 have been combined.
- Notice that the default condition can be specified.