x输出结果为多少,为什么- class Outer
- {
- private int x = 3;
-
- class Inner//内部类
- {
- int x = 4;
- void function()
- {
- int x = 6;
- System.out.println(Outer.this.x);
- System.out.println(this.x);
- System.out.println(+x);
- }
- }
- void method()
- {
- Inner in = new Inner();
- in.function();
- }
- }
- class InnerClassDemo
- {
- public static void main(String[] args)
- {
- Outer out = new Outer();
- out.method();
- }
- }
复制代码
|
|