用 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

【eclipse】No enclosing instance of type A is accessible. Must qualify the allocation with an enclosing instance of type A的更多相关文章

  1. 【转】Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing

    最近在看Java,在编译写书上一个例子时,由于书上的代码只有一部分,于是就自己补了一个内部类.结果编译时出现:No enclosing instance of type E is accessible ...

  2. Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing

    Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing   ...

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

    在编译一个例子时,结果编译时出现: No enclosing instance of type test8 is accessible. Must qualify the allocation wit ...

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

    之前看内部类的时候没发现这个问题,今天写代码的时候遇到,写个最简单的例子: 下面这一段代码 红色的部分就是编译报错: No enclosing instance of type Outer is ac ...

  5. 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).

    Java编写代码过程中遇到了一个问题,main方法中创建内部类的实例时,编译阶段出现错误,查看错误描述: No enclosing instance of type Test is accessibl ...

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

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

  7. No enclosing instance of type test is accessible. Must qualify the allocation with an enclosing inst

    今日遇到一个报错如下: No enclosing instance of type test is accessible. Must qualify the allocation with an en ...

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

    在Java中,类中的静态方法不能直接调用动态方法.只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法.所以在不做其他变动的情况下,最简单的解决办法是将public clas ...

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

    package test;import java.util.Scanner;import java.util.Random;public class caiquan { public static v ...

随机推荐

  1. ASP.NET Core MVC 之路由(Routing)

     ASP.NET Core MVC 路由是建立在ASP.NET Core 路由的,一项强大的URL映射组件,它可以构建具有理解和搜索网址的应用程序.这使得我们可以自定义应用程序的URL命名形式,使得它 ...

  2. CentOS Linux 重启详解

    一.Linux 的五个重启命令 1.shutdown 2.poweroff 3.init 4.reboot 5.halt 二.五个重启命令的具体说明 shutdown reboot 在linux下一些 ...

  3. Skyline WEB端开发1——入门

    Skyline是一套优秀的三维数字地球平台软件.凭借其国际领先的三维数字化显示技术,它可以利用海量的遥感航测影像数据.数字高程数据以及其他二三维数据搭建出一个对真实世界进行模拟的三维场景.目前在国内, ...

  4. 蓝桥杯:合并石子(区间DP+平行四边形优化)

    http://lx.lanqiao.cn/problem.page?gpid=T414 题意:…… 思路:很普通的区间DP,但是因为n<=1000,所以O(n^3)只能拿90分.上网查了下了解了 ...

  5. AD域和LDAP协议

    随着我们的习大大上台后,国家在网络信息安全方面就有了很明显的改变!所以现在好多做网络信息安全产品的公司和需要网络信息安全的公司都会提到用AD域服务器来验证,这里就简单的研究了一下! 先简单的讲讲AD域 ...

  6. 嵊州D3T1 山魔 烙饼问题

    嵊州D3T1 山魔 有n 座山,每座山有南北两面. 每一天,一些山的某一面(不一定相同) 会受到山魔的袭击. 但是山魔一天最多只会袭击k座山. 当每座山的每一面都被袭击过后,山魔就会离开. 那么至少要 ...

  7. Hash的应用

    思路:此题比较简单,直接贴代码 #include <stdio.h> int main(){ int N; ){ ]={}; ;i<N;i++){ int x; scanf(&quo ...

  8. js 使用ES6 实现从json中取值并返回新的数组或者字符串

    1.获取的json数据是这样的: data:[ { 'Id': '1', 'Phone': '123456', 'Name': '张三', }, { 'Id': '2', 'Phone': '7894 ...

  9. samrt210开发板ping-系列问题(开发板ping通主机,主机ping通虚拟机,唯独~开发板ping不通虚拟机)

    硬件:PC机.虚拟机(Linux).开发板(smart210) 常用模型: 注:1).有线网卡与无线网不可同连一个路由器,不可在同网段: 2).vmware选择桥接模式,虚拟网络适配器选定具体的网卡名 ...

  10. 微信小程序生成随机数

    const charts = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K', ...