case with and condition java code example
Example 1: java switch case
switch(x){
case(0): //if x == 0
//do some stuff
break;
//add more cases
default: //when x does not match any case
//do some stuff
break;
}
Example 2: switch statement in java
// syntax of switch statement in java
switch(expression)
{
case 1 value :
// code goes here
break;
case 2 value :
// code goes here
break;
case 3 value :
// code goes here
break;
.
.
.
.
default: // optional
// default code goes here
}