用 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. 先订一个小目标,把微信小程序搞懂

    目标:系统性学习微信小程序. 第一阶段:熟悉微信小程序及前端开发(结合web前端学习) 第二阶段:了解设计及后端 第三阶段:学习后端.

  2. Java学习笔记——MySQL创建表结构

    一.创建/删除数据库. create database t14; drop database t14; use t14; 二.创建若干表用于测试 这里预留了几个坑,下面要填坑的.. /*创建学生表*/ ...

  3. python面试题(-)可变数据类型与不可变数据类型

    python3中有六个标准的数据类型:number(数字型).string(字符串型).list(列表).type(元祖).dictionary(字典).set(集合),其中不可变类型三个:numbe ...

  4. Redis持久化深入理解

    用过Redis的都知道,Redis有两种持久化方式:RDB和AOF,他们的区别大家应该都清楚,所以今天主要想分享一下这两种持久化方式的底层原理以及实现. 如果让你手写一个持久化(架构级)的功能,你没有 ...

  5. EditPlus VC2010 and 2008 C/C++配置

    源自:http://blog.csdn.net/weiling_shen/archive/2010/03/26/5421017.aspx 对于2010跟2008差不多,只需相应的修改一下路径即可:如2 ...

  6. Maven发布项目到Nexus私服中 (发布jar包)

    目录 1 需求说明 2 实现步骤 2.1 Maven服务的setting.xml文件 2.2 项目的pom.xml文件 2.3 发布项目 1 需求说明 开发完项目后, 将项目版本发布到Nexus私服中 ...

  7. AlwaysOn 执行备份任务

    备份 使用维护计划向导创建备份 启动维护计划向导 填入计划名称,选择每项任务单独计划 选择完整备份和清除任务 配置完整备份任务,选择备份数据库 设置备份文件保存位置, 指定压缩备份,设置执行计划时间为 ...

  8. c++书籍推荐《C++编码规范》下载

    百度云及其他网盘下载地址:点我 编辑推荐 <C++编程规范:101条规则.准则与 实践>:良好的编程规范可以改善软件质量,缩短上市时间,提升团队效率,简化维护工作.在<C++编程规范 ...

  9. 扩展了一些String常用的方法.

    using System; using System.Diagnostics; using System.Security.Cryptography; using System.Text; using ...

  10. 数据结构-双向链表(Python实现)

    数据结构在编程世界中一直是非常重要的一环,不管是开发还是算法,哪怕是单纯为了面试,数据结构都是必修课,今天我们介绍链表中的一种--双向链表的代码实现. 好了,话不多说直接上代码. 双向链表 首先,我们 ...