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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
p1880554z
Posts: 2
Joined: Wed Sep 04, 2019 1:41 am
Contact:

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

Post 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

admin
Site Admin
Posts: 10383
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

What happened when you tried to compile it?

dameest
Posts: 16
Joined: Sat Nov 30, 2024 5:27 am
Contact:

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

Post 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?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests