0
How can I make multiple scanners?
6 Respuestas
+ 1
int a = sc.nextInt() ;
int b = sc. nextInt() ;
The input must be
25 67
Then a equals 25 and b equals 67
+ 4
You need not do that, just declare a single scanner class and you can use it to take as many inputs for different variables of different types. For eg-
Scanner sc = new Scanner (System.in);
int a = sc.nextInt();
float b = sc.nextFloat();
double c = sc.nextDouble();
String str = sc.nextLine();
...And so on for other types.
+ 2
You can use loops too
+ 1
This maybe can help you
https://code.sololearn.com/c0gN9LF9sj1x/?ref=app
0
Maybe your problem is that here in the app the input for the multiple scanner of your code must be all in one time separate be enter
0
What about if I need multiple inputs of one type, like two separate int variables