+ 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
6 Answers
+ 3
// You take the input only one time. So works:
int number;
do {
number = scanner.nextInt();
switch(number) { // ā¦.. and so on ā¦
+ 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 .
0
But yet the while loop needs number but if i have it before and in it there is also an Error
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();
0
try input
1 2 3 4 0
0
Oh yes i see thank you all