+ 1
How to avoid a problem we face in taking input using scanner class in java?
Scanner class in java has some methods to take different datatypes. Like nextInt for int Next for string NextLine for whole line If you use nextInt first and then nextLine the nextLine wont work .
3 Antworten
+ 3
Use nextLine twice, the first one will consume new line after nextInt and second right user input
+ 2
Michal why does it have to be like that?