+ 1

How to obtain multiple input using Scanner ?

How can I use Scanner two time in my program at different places to obtain two different inputs ? Please show an example if possible .

19th Jul 2017, 12:36 PM
Bugs Bunny
4 odpowiedzi
+ 6
No: code playground will not allow interactive (run time) inputs: it expected ALL the required input at once at start (each one separated by new line, but in only once input)
19th Jul 2017, 12:53 PM
visph
visph - avatar
+ 3
Scanner sc=new Scanner(System.in); String name=sc.nextLine(); int n=sc.nextInt();
19th Jul 2017, 12:38 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 3
you need to pass all input one by one in separate line
19th Jul 2017, 12:56 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Does code play ask for two separate inputs ? @Sami Khan (Мя. Кнап).
19th Jul 2017, 12:44 PM
Bugs Bunny