title: What is the usage of default when the switch is for an enum?
body: <p>Suppose I have an enum <code>Color</code> with 2 possible values: <code>RED</code> and <code>BLUE</code>:</p>
  
  <pre><code>public enum Color {
      RED,
      BLUE
  }
  </code></pre>
  
  <p>Now suppose I have a switch statement for this enum where I have code for both possible values:</p>
  
  <pre><code>Color color = getColor(); // a method which returns a value of enum "Color"
  switch (color) {
  case RED:
     ...
     break;
  
  case BLUE:
     ...
     break;
  
  default:
     break;
  }
  </code></pre>
  
  <p>Since I have code block for both possible values of the enum, what is the usage of <code>default</code> in the above code?</p>
  
  <p>Should I throw an exception if the code somehow reaches the <code>default</code> block like this?</p>
  
  <pre><code>Color color = getColor(); // a method which returns a value of enum "Color"
  switch (color) {
  case RED:
     ...
     break;
  
  case BLUE:
     ...
     break;
  
  default:
     throw new IllegalArgumentException("This should not have happened");
  }
  </code></pre>