[Solved] Rock Paper Scissors does not work as expected [closed]


Welcome to stackoverflow.

It seems like you’re not using any loop inside your main method, so your program simply closes after it executed the last statement.

You want to add something like:

while (!"q".equals(userChar) && !"Q".equals(userChar)) {
  System.out.println("Choose R for Rock, P for Paper, S for Scissors, or Q to Quit, and press Enter: ");
  userChar = sc.next().charAt(0);
  // Add your code where you check the randomNumber and the userChar here
}

Moreover you want to check your curly braces as the comments already state.

1

solved Rock Paper Scissors does not work as expected [closed]