Why wonā€™t this work?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Why wonā€™t this work??

Please tell me why this will not work. I am Confused that age Is working but weight and name Isnā€™t. I am new to java so please donā€™t judge. https://code.sololearn.com/cmbwbkX26n7k/?ref=app

22nd Sep 2019, 4:05 PM
HAYDEN DIMARCANTONIO
HAYDEN DIMARCANTONIO - avatar
5 Respostas
+ 3
Your code is correct but will not work on sololearn because it does not support multiple scanner. Scanner scan = new Scanner(System.in); int age = scan.nextInt(); int weight = scan.nextInt(); String name = scan.next() or scan.nextLine();
22nd Sep 2019, 4:37 PM
Denise RoƟberg
Denise RoƟberg - avatar
+ 1
ohhh, ok thanks!
22nd Sep 2019, 5:03 PM
HAYDEN DIMARCANTONIO
HAYDEN DIMARCANTONIO - avatar
+ 1
ok thanks
22nd Sep 2019, 5:21 PM
HAYDEN DIMARCANTONIO
HAYDEN DIMARCANTONIO - avatar
0
i thought that there was some error that i was just blind to, and in python you can have multiple inputs, you just have to go down the next line when it asks for an input. i thought that it would be the same in java too.
22nd Sep 2019, 5:06 PM
HAYDEN DIMARCANTONIO
HAYDEN DIMARCANTONIO - avatar
0
You can have multiple inputs but not multiple scanner. Just use one scanner for all inputs (like I did in my last post). Thats all. ;)
22nd Sep 2019, 5:20 PM
Denise RoƟberg
Denise RoƟberg - avatar