Odd error in my Java program

前端 未结 2 1550
孤独总比滥情好
孤独总比滥情好 2021-01-29 06:18

I have a Java program that is designed to take an input of customers, then run a loop for each. Then the user has 3 choices to input: clowns, safari sam, or music caravan. I jus

相关标签:
2条回答
  • 2021-01-29 06:53

    You need to use nextLine() instead of next() to read user input. nextLine() will read the entire line, but next() will only read the next word.

    0 讨论(0)
  • 2021-01-29 06:57

    For reading String provided by the user in console you have to use .nextLine() So try by using this -

     String service_type = new_scan.nextLine();
    

    This should store the value of whatever you are providing in the console to the String "service_type".

    0 讨论(0)
提交回复
热议问题