Write a switch statement that checks nextChoice. If 0, print”Rock”. If 1, print “Paper”. If 2, print “Scissors”. For any othervalue, print “Unknown”. End with newline. Do not get input from theuser; nextChoice is assigned in main().
code Given:
import java.util.Scanner;
public class Roshambo {
public static void main (String [] args) {
int nextChoice;
nextChoice = 2;
/* Your solution goes here */
}
}
Solution
public class Roshambo { public static void main(String args[]){ int nextChoice; nextChoice = 2; switch (nextChoice){
OR
OR