+ 1

Can I have a program with more than one user input?

If not, is there a way I can separate two variables in a user input

13th Dec 2017, 1:03 PM
Clarke
Clarke  - avatar
4 Answers
+ 6
Asking for Sololearn's Code Playground? You just separate two inputs by a line-break.. First input in first line and second in second.
13th Dec 2017, 1:07 PM
Nikhil
Nikhil - avatar
+ 2
Thank you Nikhil And then how do I transfer them separately into doubles?
13th Dec 2017, 1:17 PM
Clarke
Clarke  - avatar
- 1
Depending on how you read the inputs, you could put them on 1 line or hundreds. If you're using Scanner, each input is separated by whitespace so: 1 2 3 and 1 2 3 are identical to your code.
13th Dec 2017, 1:17 PM
John Wells
John Wells - avatar
- 1
Scanner nextDouble() method reads one double and returns it's value to be assigned as needed.
13th Dec 2017, 1:21 PM
John Wells
John Wells - avatar