1
vote
6answers
4k views

How to get out of while loop in java with Scanner method “hasNext” as condition?

I am a beginner at java programming and has run into a strange issue. Below is my code, which asks user for input and prints out what the user inputs one word at a time. The problem is the program ...