java 出现No enclosing instance of type Test1 is accessible. Must qualify the allocation with an enclos

来源:互联网 发布:移动网络优化工程师 编辑:程序博客网 时间:2024/05/16 12:48

大概情况就是这样一段代码报错,查找资料解决,这里记录一下

public class Test1 {    class A{    }    public static void main(String[] args) {        /**        *报错:        No enclosing instance of type Test1 is accessible. Must qualify the allocation with an enclosing instance of type Test1 (e.g. x.new A() where x is an instance of Test1).        */        A a =new A();//这里报错,把A 改下 static 的就可以    }}

参考

非常感谢

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

阅读全文
0 0
原创粉丝点击