title: Java: access to the constants in an enumeration (enum)
body: <p>reading the SCJP book, I've found something like this in the chapter 1 "self-test" :</p>
  
  <pre><code>enum Animals {
      DOG("woof"), CAT("meow"), FISH("burble");
      String sound;
      Animals(String s) { sound = s; }
  }
  
  class TestEnum {      
      static Animals a; 
      public static void main(String[] args) {                                                                                     
          System.out.println(a.DOG.sound + " " + a.FISH.sound);   
  
          // the following line is from me
          System.out.println(Animals.DOG.sound + " " + Animals.FISH.sound);
      }
  } 
  </code></pre>
  
  <p>Note: the code compile fine.
  What I don't understand is why we can access the DOG, CAT or FISH constants from the variable <code>a</code>. I thought (and it is also written in the book) that the DOG, FISH, CAT being constants are implemented in a way similar to <code>public static final Animals DOG = new Animals(1);</code>
  So if they really are static why can we access them from <code>a</code> ?
  The last line is the way I am familiar with.</p>