switch-case statement | the keyword default and the default statements if they are not needed | using polymorphism | switch(integer producing expression) { case integer constant 1: // statements to execute for integer 1 break; case integer constant 2: // statements to execute for integer 2 break; ... default: // statements to execute if none of the above is true break; }
| int month; switch (month) { case 1: System.out.println("January"); break; case 2: System.out.println("February"); break; case 3: System.out.println("March"); break; default: System.out.println("Not January, February or March" } | to execute one of a choice of statements depending on the value of a variable | case statement | decision making statement |