No enclosing instance of type ThreadTest is accessible.错误解决
2014-08-10 21:23
731 查看
闲着学习了一下线程的知识,于是创建了一个类,跟着教材上敲了一下代码,结果在MyEclipse中出现了
No enclosing instance of type TestThread is accessible. Must qualify the allocation with an enclosing instance of type TestThread (e.g. x.new A() where x is an instance of TestThread).这样的错误提示,看看语义,翻译过来以后大概意思是:没有可访问的内部类TestThread的实例。百度了一下此项内容,大部分都是说类的动态和静态调用的问题,仔细看看原来是讲另一个类写在了main方法里面了,将其方法移出main方法之外出现以下情况
The public type Runner1 must be defined in its own file,至此问题很显然,原来需要另外new一个Runner1,将TestThread里面的Runner1删除就可以了,内中原理也一应明了,轻松解决。
No enclosing instance of type TestThread is accessible. Must qualify the allocation with an enclosing instance of type TestThread (e.g. x.new A() where x is an instance of TestThread).这样的错误提示,看看语义,翻译过来以后大概意思是:没有可访问的内部类TestThread的实例。百度了一下此项内容,大部分都是说类的动态和静态调用的问题,仔细看看原来是讲另一个类写在了main方法里面了,将其方法移出main方法之外出现以下情况
The public type Runner1 must be defined in its own file,至此问题很显然,原来需要另外new一个Runner1,将TestThread里面的Runner1删除就可以了,内中原理也一应明了,轻松解决。
相关文章推荐
- JAVA编译错误 “No enclosing instance of type XXX is accessible”的解决方法
- java编译错误No enclosing instance of type TestFrame is accessible. Must qualify the allocation with an enclosing instance of type TestFrame (e.g. x.new A(
- 解决No enclosing instance of type * is accessible
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type SimpleTh
- java解决 No enclosing instance of type XXX is accessible的问题
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type SimpleT
- 解决android出现static void xxx No enclosing instance of type xxx is accessible
- 解决No enclosing instance of type * is accessible
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type SimpleTh
- No enclosing instance of type test is accessible.
- No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosing inst
- 错误提示:No enclosing instance of type A is accessible. Must qualify the allocation with an enclosing
- - No enclosing instance of type Test is accessible. Must qualify the allocation with an enclosing in
- java编译错误处理No enclosing instance of type demo1_1 is accessible.
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type SimpleT
- 问题No enclosing instance of type E is accessible的解决
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type SimpleT
- Java编译错误“No enclosing instance of type AA is accessible. Must qualify the allocation with an enclosing instance of type
- Java错误No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- 验证参数传递引发的Java编译错误“No enclosing instance of type XXX is accessible" 及匿名内部类