Carey_Wu
2016-02-26 22:01
为什么我的new Thread(new Actress(), "Ms.Runnable");这句上的new Actress()爆出这个下面这个错误。但我把Actress类前面加成static就好了,老师的Actress不是静态类但却没有报错。。 No enclosing instance of type Actor is accessible. Must qualify the allocation with an enclosing instance of type Actor (e.g. x.new A() where x is an instance of Actor).
先搞清楚static 的作用,就是共享,如果一个类要被声明为static的,只有一种情况,就是静态内部类
我也是加了一个STATIC 才能运行 不然就一直报错
深入浅出Java多线程
186067 学习 · 502 问题
相似问题