0

Switch case executing both of the cases insteAd of 1

The whole description is in the program And run it in eclipse not the default SoloLearn one It doesn't work here I guess. Any help will be appreciated I can't seem to figure out why it's executing both of the cases When 1 is the input https://code.sololearn.com/cZsEo22KQVSl/?ref=app

7th Apr 2019, 1:46 PM
kuku Debbarma
kuku Debbarma - avatar
2 Answers
+ 1
The reason is explained here: https://www.sololearn.com/learn/Java/2145/
7th Apr 2019, 1:56 PM
Anna
Anna - avatar
+ 2
I totally forgot that we had to add break inside a case to break the loop. Been weeks without coding ty :)
7th Apr 2019, 1:58 PM
kuku Debbarma
kuku Debbarma - avatar