java内部类的调用方式


public class DotThis {
public class Inner{
public DotThis outer(){
return DotThis.this;
};
}
/*
1.第一种 必须创建获取内部类的方法
public Inner inner(){
return new Inner();
}*/
public static void main(String[] args) {
//DotThis dt = new DotThis();
//DotThis.Inner dti=dt.inner();
//2.第二种直接就能获取到
DotThis dotThis = new DotThis();
Inner inner = dotThis.new Inner();
}
}