classWorkimplementsRunnable{Threadother;Work(Threadother){this.other=other;}publicvoidrun(){try{other.join();}catch(Exceptione){}System.out.print(afterjoin);}}classLaunch{publicstaticvoidmain(String[]args){newThread(newWork(Thread.currentThread())).start();System.out.print(afterstart);}}结果为:()A.afterjoinB.afterstartC.afterjoinafterstartD.afterstartafterjoin
classWorkimplementsRunnable{Threadother;Work(Threadother){this.other=other;}publicvoidrun(){try{other.join();}catch(Exceptione){}System.out.print("afterjoin");}}classLaunch{publicstaticvoidmain(String[]args){newThread(newWork(Thread.currentThread())).start();System.out.print("afterstart");}}结果为:()
A.afterjoin
B.afterstart
C.afterjoinafterstart
D.afterstartafterjoin
相关考题:
WhichtwocodefragmentswillexecutethemethoddoStuff()inaseparatethread?() A.newThread(){publicvoidrun(){doStuff();}}B.newThread(){publicvoidstart(){doStuff();}}C.newThread(){publicvoidstart(){doStuff();}}.run();D.newThread(){publicvoidrun(){doStuff();}}.start();E.newThread(newRunnable(){publicvoidrun(){doStuff();}}).run();F.newThread(newRunnable(){publicvoidrun(){doStuff();}}).start();
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();
针对下列程序段,需要( )个测试用例才可以满足语句覆盖的要求。switch(value){case 0:other=30;break;case 1:other=50;break;case 2:other=300;case 3:other=other/value;break;default:other=other*value;}A.2B.3C.4D.5
1、针对下列程序段,需要()个测试用例才可以满足语句覆盖的要求。 switch (value ) { case 0: other = 30; break; case 1: other = 50; break; case 2: other = 300; case 3: other = other/value; break; default: other = other * value; }A.2B.3C.4D.5
2、若有以下说明和语句,则引用方式不正确的是? struct worker{ int no; char *name; }work, *p=work;A.work.noB.(*p).noC.p->noD.work->no
若有以下说明和语句,则引用方式不正确的是? struct worker{ int no; char *name; }work, *p=work;A.work.noB.(*p).noC.p->noD.work->no