0

User input?

How do I do if I want to have 2 user inputs?

22nd Nov 2017, 4:59 PM
Ludvig Bergstrand
4 Answers
+ 3
You have to know that the code playground takes all inputs in the whole program at start.
22nd Nov 2017, 7:23 PM
Jonas Schröter
Jonas Schröter - avatar
+ 10
Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int x = scan.nextInt(); double b = scan.nextDouble(); This way you can take user input as many as you need. Just make sure to use the appropriate method based on the data type.
22nd Nov 2017, 5:16 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
?
23rd Nov 2017, 12:40 PM
Jonas Schröter
Jonas Schröter - avatar
- 4
hlw
23rd Nov 2017, 12:38 PM
M Boktiar Kholji
M Boktiar Kholji - avatar