Reputation: 11
I have developed a character sorter and I want to prompt the user to enter a new string every time after the string is sorted. The issue I am having is that the scanner keeps scanning the first input of the user. If I use scanner.next(), it does not counts the white space at the end of the input, which is not the solution.
This is the start of the while loop. Once the code finishes, it starts again from "inputText".
inputText:
while(keepSorting){
System.out.print("Please input the string to be sorted: " );
c.settingInput(s.nextLine());
System.out.println(" ");
int option;
more code
.... }
Upvotes: 0
Views: 474