switch(variable){
case condition: //processing;
break;
case condition: //processing;
break;
default: //processing;
break;
}
-Although the default label is customarily written at the very end, ** There is no problem if you write something other than the last **
・ If you forget to write the break statement **, you will proceed to the processing of the next condition ** (fallthrough)
·constant **-The same type as or compatible with the variable type described in the conditional expression **
·variable **-Types that are incompatible with the variable types described in the conditional expression ** ** ・ null ** ** ・ Long type ** ** ・ Boolean type **
Recommended Posts