Switch
The switch statement is Java's multi way branch statement. It gives an simple way to  dispatch execution to  various categories  of  your  code  based on  the  value of  an expression. As such, it frequently gives a better alternative than a huge series of if-else- if statements. Here is the common form of a switch statement:
switch (expression) {
 
case value1:
 
/ / statement sequence
 
break;
 
case value2:
 
/ / statement sequence
 
break;
 
.
 
.
 
.
 
case valueN:
 
/ / statement sequence
 
break;
 
default:
 
/ / default statement sequence
 
}
 
The expression must be of type short, byte, int or char, each of the values specified in the case statements have to be of a type compatible along with the expression. Every case value  must  be  a  unique  literal  (which  is,  it  have to  be  a  constant,  not  a  variable). Duplicate case values are not permitted.