title: Why doesn't String switch statement support a null case?
body: <p>I am just wondering why the Java 7 <code>switch</code> statement does not support a <code>null</code> case and instead throws <code>NullPointerException</code>? See the commented line below (example taken from <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html" rel="noreferrer">the Java Tutorials article on <code>switch</code></a>):</p>
  
  <pre><code>{
      String month = null;
      switch (month) {
          case "january":
              monthNumber = 1;
              break;
          case "february":
              monthNumber = 2;
              break;
          case "march":
              monthNumber = 3;
              break;
          //case null:
          default: 
              monthNumber = 0;
              break;
      }
  
      return monthNumber;
  }
  </code></pre>
  
  <p>This would have avoided an <code>if</code> condition for null check  before every <code>switch</code> use.</p>