第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

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).

public?class?Actor?extends?Thread?{
public?void?run(){
System.out.println(getName()+"是一個(gè)演員");
int?count=0;
boolean?keeprunning=true;
while(keeprunning){
System.out.println(getName()+"登臺(tái)演出"+(++count)+"次");

if(count==100){
keeprunning=false;
}

if(count%10==0){
try?{
Thread.sleep(1000);
}?catch?(InterruptedException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
}
}
System.out.println(getName()+"演出結(jié)束了");
}
class?Actress?implements?Runnable{

@Override
public?void?run()?{
//?TODO?Auto-generated?method?stub
System.out.println(Thread.currentThread().getName()+"是一個(gè)演員");
int?count=0;
boolean?keeprunning=true;
while(keeprunning){
System.out.println(Thread.currentThread().getName()+"登臺(tái)演出"+(++count)+"次");

if(count==100){
keeprunning=false;
}

if(count%10==0){
try?{
Thread.sleep(1000);
}?catch?(InterruptedException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
}
}
System.out.println(Thread.currentThread().getName()+"演出結(jié)束了");

}

}
public?static?void?main(String[]?args)?{
Thread?actor=new?Actor();
actor.setName("MESSI");
actor.start();
Thread?actressThread=new?Thread(new?Actress(),"C.Ronaldo");

actressThread.start();
}
}



正在回答

4 回答

也可以全部寫在里面,但是要用static class Actress implements Runnable{}來創(chuàng)建這個(gè)類。也就是必須聲明是靜態(tài)的。

0 回復(fù) 有任何疑惑可以回復(fù)我~

原來如此。。。

0 回復(fù) 有任何疑惑可以回復(fù)我~

問題已解決,不應(yīng)該吧Actress類卸載Actor類里面

0 回復(fù) 有任何疑惑可以回復(fù)我~

http://img1.sycdn.imooc.com//58072fa100019d1008820110.jpg

提示的錯(cuò)誤是這樣的

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

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).

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)