I put Compilation Error, because:
1. It will fail to compile
2. In my notes, I just put it expects a 'case' statement
About Question com.enthuware.ets.scjp.v6.2.399 :
Moderator: admin
-
- Posts: 9
- Joined: Sat Feb 25, 2012 3:51 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.399 :
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 {} ?
My question is, what would be the point of having an empty switch {} ?
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.399 :
An empty switch is same as an empty if. No point.
Who is online
Users browsing this forum: No registered users and 13 guests