title: Java switch - incorrect case executed after missing break. Why?
body: <p>I was learning Java online and came to the lesson on switch. To fool around, I remove one of the breaks after a particular case (which would be executed). I had thought that it would then check the next case, see that the condition is false, and skip to the default case before exiting. Instead, it executed the incorrect case and broke before the default case. </p>
  
  <p>What went wrong here?</p>
  
  <pre><code>public class Switch {
      public static void main(String[] args) {
  
          char penaltyKick = 'R';
  
          switch (penaltyKick) {
  
              case 'L': System.out.println("Messi shoots to the left and scores!");
                                  break; 
              case 'R': System.out.println("Messi shoots to the right and misses the goal!");
  
              case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
                                  break;
              default:
                  System.out.println("Messi is in position...");
  
          }
  
      }
  }
  </code></pre>
  
  <p>Edit: Forgot to mention. The output was:</p>
  
  <pre><code>Messi shoots to the right and misses the goal! 
  Messi shoots down the center, but the keeper blocks it!
  </code></pre>