摘要: 1.内部类可以直接访问外部类中的成员,包括私有原因:因为在内部类中持有一个外部类的应用,格式:外部类.thisclass Outer {private int x = 1;class Inner {int x = 2;public void seeOuter() {int x = 3;System.out.println(x);System.out.println(this.x);System.out.println(Outer.this.x);}}}2.外部类要访问内部类,必须建立内部类对象A.从外部类的非静态方法中访问内部类class Outer {private int x = 1;pu 阅读全文
posted @ 2013-10-09 10:33 BrightSea 阅读(908) 评论(0) 推荐(0) 编辑