title: What is the access level of variables in enums by default
body: <p>Recently I've come across the following piece of code:</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);//Expected compilation failure
      }
  }
  </code></pre>
  
  <p>I would expect the code to fail to compile because of this <code>a.DOG.sound</code> part. But to my surprise it doesn't. I've searched all around including the <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html" rel="noreferrer">official documentation</a> to find out the access level but found nothing. Is it <strong>public</strong> or <strong>default</strong>?</p>