title: Java enum and nested classes
body: <p>I'm a beginner with Java (Objective-C is my most well known language) and I'm really struggling to locate a clean example of what I'm trying to achieve:</p>
  
  <pre><code>public class OuterClass extends ClassToExtend {
  
      public enum Enum { value1, value2 }
  
      public class InnerClass extends AnotherClassToExtend {
  
          public void aMethod(int position) {
              switch (position) {
                  case Enum.value1:
                      //Do something
                  case Enum.value2:
                      //Do Something else
              }
          }
      }
  }
  </code></pre>
  
  <p>Obviously this does not work (the references to the enum) but should give an idea of what I am trying to do, <strong>what needs changing to make this work?</strong>
  I think I need to declare the enum somewhere to reference it?</p>
  
  <p>I would be grateful for an explanation of the corrections so that I can learn and hopefully solve similar difficulties for myself in the future.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong> What if the method was an @Override and the signature could not be changed?</p>