未知题型
下列程序的运行结果是______。 Class C14 implements Runnable { private int i; public C14(int n) { this.i = n; } public void run{) { try { ThreaD.currentThread().sleep(i); } catch(InterruptedException ie) { System.err.println(iE.tString()); } System.out.println('线程' + ThreaD.currentThread() .getName + '睡眠了' + i + '毫秒结束'); } } public class Testl4 { public static void main(String[] args) { Thread t = new Thread(new C14(300), 't'); t.start(); } }
A.线程t睡眠了300毫秒结束
B.线程Thread-0睡眠了300毫秒结束
C.线程t睡眠了i毫秒结束
D.线程Thread-0睡眠了i毫秒结束
- A.i
B.currentThread().sleep(i);
C.err.println(iE.tString());
D.out.println('线程'
E.currentThread()
F.getName
G.start();
H.线程t睡眠了300毫秒结束
B.线程Thread-0睡眠了300毫秒结束
C.线程t睡眠了i毫秒结束
【参考答案】
A
解析:由于类C14实现了Runnable接口,没有继承类Thread,因此需要调用 Thread.curre......
(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
点击查看答案
相关考题
-
单项选择题
黄山之美在于()A、雄伟B、秀丽C、奇特D、幽静 -
未知题型
某国2004年经济增长率为8%,其中总资本投入量的增长与总劳动投入量的增长均为4%,资本和劳动力对经济增长贡献的权数均为0.5,则全要素生产率(TFP)为( )。A.0.4%.B.0.6%.C.0.3%.D.0.5%.
A.5,则全要素生产率(TFP)为(
B.0.4%.
B.0.6%.
C.0.3%. -
未知题型
某国2003年总投资额为5万亿元,预计年度投资综合增长率为45%,按年增长率法计算的2004年年度投资规模为( )万亿元。D.6.032
A.4.582
B.5.038
C.5.075
