title: Enum Switch statement Java 6 "Default" case
body: <pre><code>private enum CLASS {FMAN, SOPH, JUN, SEN, GRAD, ERROR};
  
  private CLASS stringToClass(String t){
  
      switch(CLASS.valueOf(t))
      {
      case FMAN: return CLASS.FMAN;
      case SOPH: return CLASS.SOPH;
      case JUN: return CLASS.JUN;
      case SEN: return CLASS.SEN;
      case GRAD: return CLASS.GRAD;
      default: 
          System.out.println("NOT VALID CLASS. ERROR");
          return CLASS.ERROR;
      }
  }
  </code></pre>
  
  <p>So I have this piece of code right here. While constructing, I have this method to return corresponding values from a given string t. </p>
  
  <p>My question is, lets say "t" ends up being "CSE". How do I handle that and basically return the value of CLASS.ERROR.?</p>
  
  <p>This is in Java 6, not 7 by the way.</p>