【发布时间】:2014-06-06 03:49:47
【问题描述】:
我这里有创建嵌套类的代码,然后检查是否存在值。答案在 [???] 当前所在的位置,给我的代码无法更改。
//The answer must have balanced parentesis
class A{
class C{
int foo(){return 42;}
}
}
public class Exercise{
public static void main(String [] arg){
assert ([???].foo()==42);
}
}
问题:如何访问 C 中的 foo() 方法(在 A 中)?
【问题讨论】:
标签: java class testing assert nested-class