GiventhatastaticmethoddoIt()inaclassWorkrepresentsworktobedone,whatblockofcodewillsucceedinstartinganewthreadthatwilldothework?CODEBLOCKa:Runnabler=newRunnable(){publicvoidrun(){Work.doIt();}};Threadt=newThread(r);t.start();CODEBLOCKb:Threadt=newThread(){

题目

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


相似考题