万能百科  > 计算机   > 

GiventhatastaticmethoddoIt()inaclass

2021-05-06   

GiventhatastaticmethoddoIt()inaclassWorkrepresentsworktobedone,whatblockofcodewillsucceedinstartinganewthreadthatwilldothework?

CODEBLOCKa:

Runnabler=newRunnable(){

publicvoidrun(){

Work.doIt();

}

};

Threadt=newThread(r);

t.start();

CODEBLOCKb:

Threadt=newThread(){

publicvoidstart(){

Work.doIt();}};

t.start();

CODEBLOCKc:

Runnabler=newRunnable(){

publicvoidrun(){

Work.doIt();

}

};

r.start();

CODEBLOCKd:

Threadt=newThread(newWork());

t.start();

CODEBLOCKe:

Runnablet=newRunnable(){

publicvoidrun(){

Work.doIt();

}

};

t.run();

正确答案:

参考A

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签