我有以下类和嵌套枚举:
public class MyClass {
private Integer field;
private enum SelectedValue{
ALL {
@Override
public Integer getAmount() {
return field; //Error: field cannot be resolved to a variable
}
};
public abstract Integer getAmount();
}
}
Run Code Online (Sandbox Code Playgroud)
是否有可能在枚举体中包含实例?