0

Why this code takes only 1 input instead of 2 ?

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner a= new Scanner(System.in); String b= a.next(); String c = a.nextLine(); System.out.println(b); System.out.println(c); } }

16th Jun 2021, 4:02 AM
kushal
5 ответов
+ 3
Code will take 2 input,but in Sololearn you have to give all yours inputs in one prompt
16th Jun 2021, 4:16 AM
Abhiyantā
Abhiyantā - avatar
+ 2
If you run your Code then a while color box will pop out! At that box you have to give input
16th Jun 2021, 4:45 AM
Abhiyantā
Abhiyantā - avatar
+ 2
As Rishav said, it will appear only 1 text box(prompt) and in it you must type the two words separated by space.
16th Jun 2021, 11:06 AM
Érika 👻
Érika 👻 - avatar
0
Rishav Tiwari one prompt ??
16th Jun 2021, 4:43 AM
kushal
0
Érika 👻 i got it but why do i get a space in the second output and how can i remove that ?
17th Jun 2021, 4:24 AM
kushal