System.out.println(scanner.next());
}
In this case, which of .hasNext and .next() requires an input? And at first?
Please format the code you posted, by wrapping it in triple backticks. -> `
Imagine you are taking Strings from a txt instead of the keyboard, and each line is an imput. Without that while(scanner.hasNext()) you would just read the first ilne
Обсуждают сегодня