//内部类可以被私有修饰
class innter{
int x = 4;
void function(){
int x =8;
System.out.println("内部局部"+x);
System.out.println("内部成员"+this.x);
System.out.println("外部成员"+Outer.this.x);
}
}
void method(){
innter in = new innter();
in.function();
System.out.println(x);
}
}
public class InnerClassDemo {
public static void main(String args[]){
//通过外部类访问内部类
Outer out = new Outer();
out.method();
//直接访问内部类的成员
Outer.innter in =new Outer().new innter();//
in.function();
}
}