class BadSwitch { 
  public static void main(String[] args) {
    /** create a "bad" switch ... see what happens.  Specifically - what if we forget
     *  to add the break?
     switch (<variable>) 
     {
     case <case1>: <action performed>; // where <variable> == <case>
     break;               // if you don't break, will continue evaluating
     case <case2>: <action performed>;
     break;
     default:      <default action to perform if no equalities in case statements are matched>;
     break; // if there is no default and nothing matches, nothing happens.
     }
     */
    int myVar = 1;
    System.out.println("the integer is actually 1, this is what happens" +
                       "\n when the break is kept in the switch statement:\n");
    switch (myVar)       
    {
      case 1: System.out.println("the integer is 1");
              break;
      case 2: System.out.println("the integer is 2");
              break;
      case 3: System.out.println("the integer is 3");
      break;
      case 4: System.out.println("the integer is 4");
      break;
      case 5: System.out.println("the integer is 5");
      break;
      default:System.out.println("the integer is some other number");      
      break;
      
    }
    myVar = 1;
    System.out.println("\n\nthe integer is actually 1, this is what happens" +
                       "\nwhen the break is removed from the switch statement:\n");
    switch (myVar)       
    {
      case 1: System.out.println("the integer is 1");
      case 2: System.out.println("the integer is 2");
      case 3: System.out.println("the integer is 3");
      case 4: System.out.println("the integer is 4");
      case 5: System.out.println("the integer is 5");
      default:System.out.println("the integer is some other number");      
    }
  }  
}
