Relative Content

Tag Archive for javaoraclejava.util.scanner

Scanner doesn’t take input after first round of the for loop

I want to run a block of code which repeats until user wants to exit themself. So I put it into a for loop where it’ll keep iterating until user enters 0 as a choice. It works fine in the first iteration but as soon as it goes for the second iteration, it stops asking for values from user, and just proceeds with null. Here’s the main()‘s code. I’ve only included the relevant code lines.