Questions tagged as 'java-util-scanner'

2
answers

Continue if it is a letter

Good morning, I was wondering if it is possible to force the user to put a letter or not advance. With an int it would be something like this: int x = 0; while (x < 1){ if(lector.hasNextInt){ int numero = lector.nextInt();...
asked by 03.01.2018 / 21:43
1
answer

Problem when implementing a Scanner in a Switch structure

Hi, I'm having a problem when I implement a Scanner in a Switch structure. Here's an example of how I have my code. Problem: When I run the program I skip the case of the switch, it does not allow me to enter the data and the program con...
asked by 19.12.2017 / 02:16
3
answers

Problem when using Scanner # nextLine (); inside a for

The question is that I want to enter a String that can contain space (ex: United States) and for that reason I use the nextLine, but also in that same method I enter data type Int. The problem is that being inside a for in the second entry, it g...
asked by 20.01.2016 / 02:32