I have an interface – here’s a nicely contrived version as an example:
public interface Particle { enum Charge { POSITIVE, NEGATIVE } Charge getCharge(); double getMass(); etc... }
Is there any difference in how implementations of this would behave if I defined the Charge enum as static – i.e. does this have any effect:
public interface Particle { static enum Charge { POSITIVE, NEGATIVE } Charge getCharge(); double getMass(); etc... }
No, it makes no difference. However the reason is not because it is a member declaration inside an interface, as Jon says. The real reason is according to language spec (8.9) that
At the following example static does not make any difference either (even though we have no interface):
Another example with a nested private enum (not implicitly public).