title: Extending enum in Java
body: <pre><code>public enum myEnum {    
  VAL1(10), VAL2(20), VAL3("hai") {
          public Object getValue() {
              return this.strVal;
          }
          public String showMsg() {
              return "This is your msg!";
          }
      };
      String strVal;
      Integer intVal;
      public Object getValue() {
          return this.intVal;
      }
      private myEnum(int i) {
          this.intVal = new Integer(i);
      }
      private myEnum(String str) {
          this.strVal = str;
      }
  }
  </code></pre>
  
  <p>In the above enum what exactly happens when I add a constant specific class body for VAL3?<br><br>
  The type of VAL3 is definetly a subtype of myEnum as it has overloaded and additional methods. (the class type comes as 'myEnum$1' ) <br><br>
  But how can the compiler creates a subtype enum extending myEnum as all the enums are already extending java.lang.enum ? <br></p>