调用方式:
静态内部类:
OuterClass.StaticInerCls staticInerCls = new OuterClass.StaticInerCls();
非静态内部类:
OuterCls outerCls = new OuterCls();
OuterCls.InerCls inerCls = outerCls.new InerCls();
tips:
且非静态内部类 不能拥有静态成员变量以及方法:
内部类和外部类 编译过后是两个类 outer.class 和 outer$inner.class,
如果外部类没有实例化 内部类也没有加载 此时调用内部类的静态成员和方法显然会出错 所以内部类不能拥有静态成员和方法