class Outer {
public int num = 10;
class Inner {
public int num = 20;
public void show() {
int num = 30;
System.out.println(?);//打印30 应该填num
System.out.println(??);//打印20 this.num
System.out.println(???);//打印10 Outer.this.num
}
}
}
class InnerClassTest {
public static void main(String[] args) {
Outer.Inner oi = new Outer().new Inner();
oi.show();
}
}
//要求在控制台上打印30,20.,10
面向对象题型分析,之成员内部类 |
|