No enclosing instance of type close is accessible. Must qualify the allocation with an enclosing instance of type close (e.g. x.new A() where x is an instance of close).
对main方法而言,它是游离于任何类之外的,因此某类的非静态内部类对它而言是不直接可见的,也就无法直接访问,like this:
enclosingInstance = new EnclosingClass();
nestedInstance = enclosingInstance.new NestedClass();
为什么main方法中无法实例化非静态内部类
最新推荐文章于 2022-08-04 10:25:10 发布