Grey Matter

Eternal Sunshine Of A Spotless Mind

Archive for April 9th, 2008

switch statement- Java

with 5 comments

Why should switch statement ever fall through?

That is if we don’t give a break; in switch case the program flow goes to the next cases and executes them also.

Wonder why this redundant break; needs to be given.When the idea is to do switch case statement  something like if else if statement.

we could have it like : if at all the programmer needs the flow to fall through to next case why don’t they specifically say a continue;

Written by subbu

April 9, 2008 at 1:41 pm