Switch in java program with output. Learn java programming play java programming tutorial. Menu driven programming. Selection / Conditional Statements Execute statements based on condition Syntax - switch switch(choice variable) { case 1: statemenst to be executed for choice 1 break; case 2: statemenst to be executed for choice 2 break; .. .. default: statemenst to be executed as default choice break; } 1. choice variable restrictions It can only be - byte,short,int,char,String,enum 2. break is non mandatory but advisable 3. fall through condition 4. default is non mandatory but advisable 5. position of default - does not matter 5. sequence of cases - does not matter Example switch(month) { case 1: System.out.prinln("january"); break; case 2: System.out.prinln("february"); break; default: System.out.prinln("Not in option"s); break; }