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:
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
}
}
}
}
Obviously this does not work (the references to the enum) but should give an idea of what I am trying to do, what needs changing to make this work? I think I need to declare the enum somewhere to reference it?
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.
Thanks
EDIT: What if the method was an @Override and the signature could not be changed?