网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有:classThread2implementsRunnable{voidrun(){System.out.print("go");}publicstaticvoidmain(String[]args){Thread2t2=newThread2();Threadt=newThread(t2);t.start();}}结果为:()
A.go
B.编译失败
C.代码运行,无输出结果
D.运行时异常被抛出
参考答案
更多 “ 现有:classThread2implementsRunnable{voidrun(){System.out.print(go);}publicstaticvoidmain(String[]args){Thread2t2=newThread2();Threadt=newThread(t2);t.start();}}结果为:() A.goB.编译失败C.代码运行,无输出结果D.运行时异常被抛出 ” 相关考题
考题
classThread2implementsRunnable{voidrun(){System.out.print(go);}publicstaticvoidmain(String[]args){Thread2t2=newThread2();Threadt=newThread(t2);t.start();}}结果为:()
A.goB.编译失败C.代码运行,无输出结果D.运行时异常被抛出
考题
classOrderimplementsRunnable{publicvoidrun(){try{Thread.sleep(2000);}catch(Exceptione){}System.out.print(in);}publicstaticvoidmain(String[]args){Threadt=newThread(newOrder());t.start();System.out.print(pre);try{t.join();}catch(Exceptione){}System.out.print(post);}}可产生哪两项结果?()A.inpreB.preinC.inprepostD.preinpost
考题
classThread2implementsRunnable{voidrun(){System.out.print(go);}publicstaticvoidmain(String[]args){Thread2t2=newThread2();Threadt=newThread(t2);t.start();}}结果为()
A.goB.编译失败C.代码运行,无输出结果D.运行时异常被抛出
考题
classThreadBothextendsThreadimplementsRunnable{publicvoidrun(){System.out.print(hihi);}publicstaticvoidmain(String[]args){Threadt1=newThreadBoth();Threadt2=newThread(t1);t1.run();t2.run();}}结果为:()A.hiB.hihiC.编译失败D.代码运行,但无输出结果
考题
classOrderimplementsRunnable{publicvoidrun(){try{Thread.sleep(2000);}catch(Exceptione)System.out.print(in);publicstaticvoidmain(String[]args){Threadt=newThread(newOrder());t.start();System.out.print(pre);try{t.join();}catch(Exceptione){}System.out.print(post);可产生哪两项结果?()A.preinpostB.preinC.inpostpreD.inprepostE.prepostin
考题
现有:classThread2implementsRunnable{voidrun(){System.out.print(go);}publicstaticvoidmain(String[]args){Thread2t2=newThread2();Threadt=newThread(t2);t.start();}}结果为:()
A.goB.运行时异常被抛出C.代码运行,无输出结果D.编译失败
考题
publicclassThreads4{publicstaticvoidmain(String[]args){newThreads4().go();}publicvoidgo(){Runnabler=newRunnable(){publicvoidrun(){System.out.print(”foo”);}};Threadt=newThread(r);t.start();t.start();}}Whatistheresult?()A.Compilationfails.B.Anexceptionisthrownatruntime.C.Thecodeexecutesnormallyandprints?foo”.D.Thecodeexecutesnormally,butnothingisprinted.
考题
阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是A.Test t=flew Test()B.Thread t=new Thread();C.Thread t=new Thread(new Test());D.Test t=new Thread();
考题
阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是A.Test t=new Test();B.Thread t=new Thread();C.Thread t=new Thread(new Test());D.Test t=new Thread();
热门标签
最新试卷