【eclipse】No enclosing instance of type A is accessible. Must qualify the allocation with an enclosing instance of type A

用 eclipse 写 Java 代码时出现了这个问题,详细如下:

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

其中 A 为类名。

 

原因:原来是静态方法中不能创建动态内部类的对象。

解决方法:将类改为 static, 或将方法改为非静态的。

 

参考:http://blog.csdn.net/sunny2038/article/details/6926079

posted @ 2016-03-31 16:38  WriteOnRead  阅读(1046)  评论(0编辑  收藏  举报