本帖最后由 lfs454766767 于 2014-8-26 08:43 编辑
- class OuterX {
- int x = 10;
-
- void method() {
- final int x = 100;
- class Inner {
- int x = 1000;
- void method() {
- int x =10000;
- System.out.println(x);
- System.out.println(this.x);
- System.out.println(OuterX.this.x);
-
- }
- }
- new Inner().method();
- }
- }
- public class O{
- public static void main(String[] args) {
- OuterX x = new OuterX();
- x.method();
- }
- }
复制代码 怎么在内部类中的方法内访问 final的那个 x??
|
|