0

How can i get multiple input in java?

3rd Feb 2020, 6:50 PM
EL AAOUAM MOHAMED
EL AAOUAM MOHAMED - avatar
5 odpowiedzi
+ 4
I guess you have troubles with sololearn input. You have to enter all values at the beginning. for example you want to integer. Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); Now you have to enter the values in this form: 3 2 If you use nextLine(): String s1 = scan.nextLine(); String s2 = scan.nextLine(); Here you have to enter in this form: "hello" [enter] "test"
3rd Feb 2020, 7:00 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Using loops to repeat input and ArrayList to store an array of variable length You can also try the split() method
3rd Feb 2020, 6:56 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 1
Can you be specific more about your question..? If you are asking about SL compiler, then you need to give all required inputs at ones only by space separated or in line by line..
3rd Feb 2020, 6:59 PM
Jayakrishna 🇮🇳
+ 1
Thank you so much ,i got it now
3rd Feb 2020, 8:34 PM
EL AAOUAM MOHAMED
EL AAOUAM MOHAMED - avatar
+ 1
Elaaouam Mohamed Your welcome :)
3rd Feb 2020, 8:39 PM
Denise Roßberg
Denise Roßberg - avatar