首页 > 数据库技术 > 详细

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

时间:2020-06-29 09:48:02      阅读:58      评论:0      收藏:0      [点我收藏+]

语法错误:No enclosing instance of type VolatleTest is accessible. Must qualify the allocation with an enclosing instance of type VolatleTest (e.g. x.new A() where x is an instance of VolatleTest).
例:

    public static void main(String[] args) {
        Task1 t1 =new Task1();//这里实例化的时候会报错,需要用 static 关键字来修饰内部类
    }
    
    class Task1 implements Runnable{

        @Override
        public void run() {
            
        }
        
    }

解决: static class Task implements Runnable

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

原文:https://www.cnblogs.com/zyf-yxm/p/13206133.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!