Java Reference
In-Depth Information
3.
Expand the
switch
statement to include the
for
,
while
, and
do
-
while
loops, as shown
here:
Notice that no
default
statement is present in this version of the
switch
. Since the
menu loop ensures that a valid response will be entered, it is no longer necessary to
include a
default
statement to handle an invalid choice.