Java Reference
In-Depth Information
The first statement in a switch block must be labeled, otherwise it is un-
reachable (all cases will jump over it) and your code will not compile.
Exercise 10.2
: Rewrite your method from Exercise 10.1 to use a
switch
.
Exercise 10.3
: Using your "days of the week" enum from Exercise 6.1
write a method that takes a day of the week and returns
TRue
if it is
a working day, and
false
otherwise. First use nested
ifelse
statements
and then a
switch
statement. Which do you think results in clearer code?