public enum Parent {
item1(1){
public void testing() {
add();
multiply();
minus(); // error here!!!
}
}, item2(2);
private int i ;
Parent(int i){
this.i = i;
}
public void setI(int i ){
this.i = i;
}
public int getI(){
return i;
}
public void multiply(){
}
protected void add(){
}
private void minus(){
}
}
正如大家所看到的,它们位于同一类中,为什么
minus()
不能在内部使用?通常内部类可以访问外部类中的private方法/字段
,对吧?