网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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();


参考答案

更多 “ 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(); ” 相关考题