Java 18.3 Help | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Java 18.3 Help

Can someone help me with this? I dont get any Output. My Code: https://code.sololearn.com/cacF59fH6PnJ/?ref=app

29th Jan 2022, 7:54 AM
Dvid313
Dvid313 - avatar
6 Réponses
+ 3
// You take the input only one time. So works: int number; do { number = scanner.nextInt(); switch(number) { // ….. and so on …
29th Jan 2022, 8:05 AM
JaScript
JaScript - avatar
+ 1
// this also works switch(number = scanner.nextInt()) { // … and so on … // but you necessarily need at the switch end this default : ; } // end of switch statement. Happy coding David .
29th Jan 2022, 9:32 AM
JaScript
JaScript - avatar
0
But yet the while loop needs number but if i have it before and in it there is also an Error
29th Jan 2022, 8:54 AM
Dvid313
Dvid313 - avatar
0
You can't declare a variable more than one time. You have int number; And again in loop int number = scanner.nextInt(); Just use in loop, number = scanner.nextInt();
29th Jan 2022, 9:15 AM
Jayakrishna 🇮🇳
0
try input 1 2 3 4 0
29th Jan 2022, 9:24 AM
zemiak
0
Oh yes i see thank you all
29th Jan 2022, 2:08 PM
Dvid313
Dvid313 - avatar