Page 1 of 1

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

Posted: Sat Oct 15, 2011 9:59 am
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

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

Posted: Sun Mar 04, 2012 5:09 pm
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 {} ?

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

Posted: Sun Mar 04, 2012 6:09 pm
by admin
An empty switch is same as an empty if. No point.