版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tfstone/article/details/84860578
No enclosing instance of type xx is accessible. Must qualify the allocation with an enclosing instance of type xx (e.g. x.new A() where x is an instance of xx ).
这种情况一般是在调用内部类(未被静态修饰)时出现,两种解决方法:
1、直接Inner in = new Outer().new Inner();
2、加static修饰 ,Inner in = new Inner();
例子:https://stackoverflow.com/questions/7841210/having-a-issue-using-inner-class-java
--> java编程思想: P193