No enclosing instance of type Test_02_1 is accessible. Must qualify the allocation with an enclosing

No enclosing instance of type Test_02_1 is accessible. Must qualify the allocation with an enclosingNo enclosing instance of type Test_02_1 is accessible. Must qualify the allocation with an enclosing


main是Test_02_1类的static方法,按照常理它只能访问Test类中static资源,而class A是非static所以报错了。解决方法很简单,给class A添加static属性就可以了。

static class A{}

No enclosing instance of type Test_02_1 is accessible. Must qualify the allocation with an enclosing