為什么我的new Thread(new Actress(), "Ms.Runnable");這句上的new 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).
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).
2016-12-20
舉報
2016-12-20
static 的作用,就是共享且類唯一,如果一個類要被聲明為static的,只有一種情況,就是靜態(tài)內(nèi)部類
2017-05-24
哪位大神幫幫忙????
2017-05-24
我是把 class Actress()直接寫到main方法的下面了,也出現(xiàn)了這種錯誤,我并沒有寫在Actor的里面
2017-03-02
Actress類應該被定義在Actor類的里邊了, 也就是說Actress被弄成Actor的內(nèi)部類了,把Actress類的代碼復制到Actor外邊
public class Actor(){
}
class Actress(){
}
或者new Actress()改為new Actor.Actress()就可以了.