Switch statement

The switch statement (also known as a multi-way branch statement) performs a function similar to a series of chained if-else statements.

switch(a) {
   case 1: 
      print(”one”);
      break;
   case 2:
      print(“two”);
      break;
   default:
      print(“neither one or two”);
}

Search the web for “Java switch statement” for more information about using this statement type.