Convert the following if-else-if statement into a switch statement: if (choice == 1) { System.out.println(You selected 1.);

Question:

Convert the following if-else-if statement into a switch statement: 

if (choice == 1)
{
 System.out.println("You selected 1.");
}
else if (choice == 2 || choice == 3)
{
 System.out.println("You selected 2 or 3.");
}
else if (choice == 4)
{
 System.out.println("You selected 4.");
}
else
{
 System.out.println("Select again please.");
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: