0

How can I get separately two strings from a Scanner ?

When the user enter an input in the Scanner, how can I get the input separately to obtain two strings separately ?

15th Apr 2018, 3:18 PM
Vincent Philippe
Vincent Philippe - avatar
5 Réponses
+ 4
You can ask the user to enter the values in one line but separated by comma, and then you can fix an array as follows: String[ ] input : input.nextLine( ).split(","); I assume you'll understand what split method does.
15th Apr 2018, 3:48 PM
Fabio
+ 5
How to input: split multiple inputs into seperate lines how to get multiple inputs: declare multiple scanners each of an input
15th Apr 2018, 3:20 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 3
You're welcome! ☺
15th Apr 2018, 3:50 PM
Fabio
+ 2
Ok... You helped me ! Thanks
15th Apr 2018, 3:49 PM
Vincent Philippe
Vincent Philippe - avatar
0
But I don't understand... How can I split in two strings, just one Scanner ?
15th Apr 2018, 3:33 PM
Vincent Philippe
Vincent Philippe - avatar