sac*_*ink 7 java nested class super
我有以下类层次结构场景; A类有一个方法,B类扩展了A类,我想从本地嵌套类中调用超类的方法.我希望一个骨架结构更清楚地表明场景Java是否允许这样的调用?
class A{
public Integer getCount(){...}
public Integer otherMethod(){....}
}
class B extends A{
public Integer getCount(){
Callable<Integer> call = new Callable<Integer>(){
@Override
public Integer call() throws Exception {
//Can I call the A.getCount() from here??
// I can access B.this.otherMethod() or B.this.getCount()
// but how do I call A.this.super.getCount()??
return ??;
}
}
.....
}
public void otherMethod(){
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3594 次 |
| 最近记录: |