Rewrite the following if-else-if statement as a switch statement. if (selection == 'A') System.out.println(You selected A.); else
Question:
Rewrite the following if-else-if statement as a switch statement.
if (selection == 'A')
System.out.println("You selected A.");
else if (selection == 'B')
System.out.println("You selected B.");
else if (selection == 'C')
System.out.println("You selected C.");
else if (selection == 'D')
System.out.println("You selected D.");
else
System.out.println("Not good with letters, eh?");
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Question Posted: