About Question com.enthuware.ets.scjp.v6.2.399 :

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

Moderator: admin

Post Reply
ETS User

About Question com.enthuware.ets.scjp.v6.2.399 :

Post by ETS User »

I put Compilation Error, because:

1. It will fail to compile
2. In my notes, I just put it expects a 'case' statement

MC20147
Posts: 9
Joined: Sat Feb 25, 2012 3:51 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.399 :

Post by MC20147 »

I was somewhat confused by not having a case: or default: within the swtich statement. I thought it was a compiler error becasue one of those is required but after writing some code I see that you can have a "empty" switch statement. If you remove the "flag=true;" statement it will compile and run just fine with no case: or default: statement.

My question is, what would be the point of having an empty switch {} ?

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

Re: About Question com.enthuware.ets.scjp.v6.2.399 :

Post by admin »

An empty switch is same as an empty if. No point.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests