How can I repeatedly read user input using Scanner java

前端 未结 3 1041
一个人的身影
一个人的身影 2021-01-24 13:08

I am trying to create a simple menu for my program that reads user input. Here\'s the code:

public void menu() {
        String command;

        System.out.prin         


        
3条回答
  •  一个人的身影
    2021-01-24 13:37

    You should use switch case inside the while loop instead of if. The switch case should provide the functionality depending on the input provided by the user.

提交回复
热议问题