+ 4
java switch
Could you explain me... public class SwitchRv { public static void main(String[] args) { int miphone=2; switch (miphone) { case 1 :sdas: // why not error System.out.println("Middle"); break; case 2:Samsung: //why not error System.out.println("Good"); default: break; } } } https://code.sololearn.com/cF5WYE25N7u0/?ref=app
8 Antworten
+ 7
Interesting, but I am not sure why this works.
Danijel Ivanović Do you have an idea?
Thanks for help :)
+ 3
🙁🙁 I don't get it
+ 2
(case 1: sdas:) why there is no error or is there other reason
+ 2
nais
0
I can't understand the switch help
0
I believed it worked because of the “Default” the default is automatically going to printout if all the case ve been tested and no Answer is found
As you can see it printed out the default which says : Ok if none of the above are true Do this : ...