title: Java public enum method purpose
body: <p>So I have my enum</p>
  
  <pre><code>public enum Sample {
     ValueA{
        @Override
     public String getValue(){ return "A"; }   
   },
   ValueB{
      @Override
     public String getValue(){ return "B"; }
  
     public void doSomething(){ }
   };
  abstract public String getValue();
  };
  </code></pre>
  
  <p>and I have some other code trying to use the enum.</p>
  
  <pre><code>Sample.ValueB.doSomething();
  </code></pre>
  
  <p>Which seems like it should be valid, but produces the error "The method doSomething() is undefined for the type Sample". As opposed to </p>
  
  <pre><code>Sample value = Sample.ValueB;
  value.doSomething();
  </code></pre>
  
  <p>which produces the same error and seems reasonable. </p>
  
  <p>I assume there is a reasonable answer as to why the first one doesn't work and it relates to the two examples being equivalent under the hood. I was hoping someone could point me towards the documentation on why it is that way.</p>