No enclosing instance of type * is accessible.
来源:互联网 发布:软件设计师好过吗 编辑:程序博客网 时间:2024/06/04 19:32
这是我项目中遇到的问题:
报错内容:No enclosing instance of type * is accessible. Must qualify the allocation with an enclosing instance of type * (e.g. x.new A() where x is an instance of * ).
class 直接写的是动态的内部类,可是主程序是public static void main。 (静态类)
在Java中,类中的静态方法不能直接调用动态方法。只有将某个内部类修饰为静态类,然后才能够在静态类中调用该类的成员变量与成员方法。
所以,最简单的解决办法是为 class 添加修饰 static ,使其为静态内部类 static class
问题就得到了解决
0 0
- No enclosing instance of type * is accessible.
- No enclosing instance of type is accessible.
- No enclosing instance of type ThreadTest is accessible.错误解决
- 【JAVA001】No enclosing instance of type XXX is accessible.
- No enclosing instance of type E is accessible
- No enclosing instance of type E is accessible
- 黑马程序员--No enclosing instance of type E is accessible.
- No enclosing instance of type xxx is accessible
- No enclosing instance of type E is accessible
- No enclosing instance of type Demo06 is accessible.
- No enclosing instance of type XXX is accessible
- No enclosing instance of the type RegisterActivity is accessible
- 报错:No enclosing instance of type ExtendsDemo is accessible.
- No enclosing instance of type test is accessible.
- Java出现No enclosing instance of type E is accessible
- 解决No enclosing instance of type * is accessible
- No enclosing instance of type Interface is accessible.
- Java错误:No enclosing instance of type MyClass is accessible.
- C#中的引用传递、值传递。
- Spring结合java Quartz配置实例代码
- 如何配置Kettle集群运行环境
- 常用的一些工具网址
- 适配器模式
- No enclosing instance of type * is accessible.
- hduoj 不容易系列之一--1465
- BZOJ4384: [POI2015]Trzy wieże
- DBUtils使用笔记
- poj3250+单调栈,换种数据结构和思维解决问题
- 设置fb player版本
- osv 添加自己的c++ app程序
- OnClose()和 OnDestroy()
- 开普勒架构和麦克斯韦架构是什么?有什么区别?