用 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. select下拉箭头样式重置

    select{ appearance:none; -moz-appearance:none; -webkit-appearance:none; background: url("../ima ...

  2. spring 5.x 系列第11篇 —— 整合memcached (xml配置方式)

    文章目录 一.说明 1.1 XMemcached客户端说明 1.2 项目结构说明 1.3 依赖说明 二.spring 整合 memcached 2.1 单机配置 2.2 集群配置 2.3 存储基本类型 ...

  3. Java 泛型学习总结

    前言 Java 5 添加了泛型,提供了编译时类型安全检测机制,该机制允许程序员在编译时检测到非法的类型. 泛型的本质是参数化类型,可以为以前处理通用对象的类和方法,指定具体的对象类型.听起来有点抽象, ...

  4. linux下用户权限划分

    场景: 建立一个目录为/devcode,该目录是给开发组用的,也就是只有开发组用户才能进行操作该目录.该组下有成员zhangsan,lisi  步骤: 1.创建用户组,命名dev groupadd d ...

  5. 新补充 JSSSS

    条件语句 补充: var a=“hello world” a这个变量是字符串了 对于里面每一个字母来说 他是字节 里面有11个字节 字节总数用length表示 如下: 根据上面的内容咱们又发现了一个运 ...

  6. 半小时学会V语言

    半小时学会V语言 1. V语言简介 V是一个静态类型.编译型的编程语言,目标是构建可维护软件.与Go语言相似,并受Oberon,Rust和Swift语言影响.V语言非常简单,只需要半小时就能学会这门语 ...

  7. Smobiler实现手机弹窗

    前言 在实际项目中有很多场景需要用到弹窗,如图1 那么这些弹窗在Smobiler中如何实现呢? 正文 Smobiler实现弹窗有两种方式:1.MessageBox.Show 2.ShowDialog和 ...

  8. flume1.9 用户指南(中文版)

    概述 Apache Flume是一个分布式,可靠且可用的系统,用于有效地从许多不同的source收集,聚合和移动大量日志数据到集中式数据存储. Apache Flume的使用不仅限于日志数据聚合.由于 ...

  9. kafka入门(三)备份

    一.相关概念 备份相关的角色 Kafka消息备份分三个角色:分别是Leader副本.Follower副本.ISR集合 Leader副本 负责直接响应client端的读写请求,即和生产者和消费者直接对接 ...

  10. HDU 2795:Billboard(线段树)

    http://acm.hdu.edu.cn/showproblem.php?pid=2795 Billboard Problem Description   At the entrance to th ...