I believe the intended use of nextLine
is correct. The problem however is that nextInt
does not create a newline token, and it's instead reading the rest of that line (which is empty). I believe that if another nextLine
statement would be added after that, the code would work. Next on the other hand only recognizes the first word so that might not be the correct solution.