摘要:
一、内部类的访问规则:1、内部类可以直接访问外部类中的成员,包括私有。格式为外部类名.this2、外部类要访问内部类,必须建立内部类对象。代码:class Outer{ private int x = 3; class Inner//内部类 { //int x = 4; void function() { //int x = 6; System.out.println("innner :"+Outer.this.x); } } /**/ void method() { Inner in = new Inner(); in.function(); }}class Inne.. 阅读全文
posted @ 2014-02-05 15:04
Levi.duan
阅读(277)
评论(0)
推荐(0)

浙公网安备 33010602011771号