title: How to call additional method in enums?
body: <pre><code>enum Enum1
  {
      BIG(8), HUGE(10)
      {
          public String getName()
          {
              return "Huge";
          }
  
          public String getContry()
          {
              return "India";
          }//additional Method
      },
      OVERWHELMING(16)
      {
          public String getName()
          {
              return "OVERWHELMING";
          }
      };
      private int ounces;
  
      public int getOunes()
      {
          return ounces;
      }
  
      public String getName()
      {
          return "Ponds";
      }
  
      Enum1(int ounces1)
      {
          ounces = ounces1;
      }
  }
  
  class EnumAsInnerClass
  {
      Enum1 enumInnerClass;
  
      public static void main(String[] args)
      {
          EnumAsInnerClass big = new EnumAsInnerClass();
          big.enumInnerClass = Enum1.BIG;
          EnumAsInnerClass over = new EnumAsInnerClass();
          over.enumInnerClass = Enum1.OVERWHELMING;
          EnumAsInnerClass huge = new EnumAsInnerClass();
          huge.enumInnerClass = Enum1.HUGE;
          System.out.println(big.enumInnerClass.getName());//Ponds        
          System.out.println(over.enumInnerClass.getName());//OVERWHELMING
          System.out.println(huge.enumInnerClass.getName());//Huge
      }
  }
  </code></pre>
  
  <p>Consider the above example. How can I call the method getCountry for HUGE?</p>
  
  <p>If there is no way to call this method, why does Java treat it as legal?</p>