I am expecting input with the scanner until there is nothing (i.e. when user enters a blank line). How do I achieve this?
I tried:
while (scanner.ha
Here's a way:
Scanner keyboard = new Scanner(System.in); String line = null; while(!(line = keyboard.nextLine()).isEmpty()) { String[] values = line.split("\\s+"); System.out.print("entered: " + Arrays.toString(values) + "\n"); } System.out.print("Bye!");