标签:shu stat private out 访问 ati 外部类 method 好处
/**/
public class Test {
public static void main(String[] args) {
Outer outer = new Outer();
outer.omethod();
Outer.Inner inner = new Outer().new Inner();//内部类的访问方法
inner.imethod();
}
}
class Outer{
private int onum = 1;
class Inner{
int inum = 2;
public void imethod(){
System.out.println(onum);
}
}
public void omethod(){
Inner inner = new Inner();
System.out.println(inner.inum);
}
}
标签:shu stat private out 访问 ati 外部类 method 好处
原文地址:http://blog.51cto.com/13579086/2065935