No enclosing instance of type test is accessible. Must qualify the allocation with an enclosing instance of type test (e.g. x.new A() where x is an instance of test). 问题

No enclosing instance of type test is accessible. Must qualify the allocation with an enclosing instance of type test (e.g. x.new A() where x is an instance of test).报错

出现此问题 :极大可能 是 在一个 main 方法中 出现了 直接实例化 内部类  内部类 没有 声明为 static  

解决方法 :  可以修改内部类为 static 

posted @ 2020-11-28 10:08  gnal  阅读(257)  评论(0编辑  收藏  举报