No enclosing instance of type Multh is accessible. Must qualify the allocati
来源:互联网 发布:淘宝店铺提取软件 编辑:程序博客网 时间:2024/06/11 04:43
摘自:https://zhidao.baidu.com/question/37670874.html
SimpleThread是动态内部类,创建这样对象必须有一个所在类的实例与之对应,程序是在静态方法(静态方法不属于任何实例)中直接调用动态内部类因此编译不通过。这样的错误好比类中的静态方法不能直接调用动态方法.package a;public class Multh { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public Multh() { } public static void main(String[] args) { Multh m=new Multh(); m.setName("黄玉"); Bank1 b= new Bank1(m); b.run(); } static class Bank1 implements Runnable { Multh multh; public Bank1(Multh multh){ this.multh=multh; } public void run(){ while( multh.getName()!=null){ int temp=(int)(Math.random()*1000); System.out.println("Multh.Bank1.run():"+temp); } } }}
阅读全文
0 0
- No enclosing instance of type Multh is accessible. Must qualify the allocati
- - No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosing in
- No enclosing instance of type Monster is accessible. Must qualify the allocation with an enclosing i
- No enclosing instance of type ChuangKou is accessible. Must qualify the allocation with an enclosing
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- No enclosing instance of type X is accessible. Must qualify the allocation with an enclosing
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type X is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosing inst
- No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclosing ins
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing insta
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- No enclosing instance of type * is accessible. Must qualify the allocation with an enclosing instanc
- 微信前端开发接口一览
- Ionic3 自定义组件实现图片懒加载效果
- API防重放机制
- 电脑中如何在cmd中正确使用cd命令切换文件目录
- 如何理解矩阵特征值?
- No enclosing instance of type Multh is accessible. Must qualify the allocati
- PHP中PDO解决中文乱码
- 读取dat文件
- 怎样使得Tomcat服务器启动更快 使用随机数与熵池策略
- Android Touch事件的传递机制
- oracle10g32位通过ODBC连接sqlserver2005
- kotlin搭建的Android框架
- 用jq让移动端和PC端遮罩层弹出后页面禁止滚动
- spring配置总结