我尝试这样做是:为什么我不能在Java的内部类中创建枚举?
public class History {
public class State {
public enum StateType {
Eclipse中给了我这个编译错误的StateType
:The member enum StateType must be defined inside a static member type
。
当我使State
类为静态时,错误消失。我可以使State
为静态,但我不明白为什么我不能在内部类中声明enum
。被定义为嵌套类型
请看看这个:http://stackoverflow.com/questions/700831/java-local-enums – 2013-02-13 16:23:06
除非你想状态访问历史中的方法,使国家[静态类](http:// stackoverflow.com/a/1353326/2054731)。 – ArneHugo 2014-04-15 12:26:53