Page 1 of 1

About Question enthuware.ocajp.i.v8.2.1282 :

Posted: Wed Sep 04, 2019 1:44 am
by p1880554z
What, if anything, is wrong with the following code? void test(int x){ switch(x){ case 1: case 2: case 0: default : case 4: } }


was thinking variable x in switch is not declared since it was only visible within the method

Re: About Question enthuware.ocajp.i.v8.2.1282 :

Posted: Wed Sep 04, 2019 1:55 am
by admin
What happened when you tried to compile it?

Re: About Question enthuware.ocajp.i.v8.2.1282 :

Posted: Sun Mar 09, 2025 1:40 pm
by dameest
Hello, not really an issue but just want to have your thoughts.
The fact that "case 1: 1" is not allowed for new switch expression (missing yield) but "case 1: method()" is allowed is really weird Why did they introduce such a thing?