试题与答案

请阅读下面程序 public class ThreadTest public

题型:单项选择题

题目:

请阅读下面程序
public class ThreadTest
public static void main(String args[])throws Exception
int i=0:
Hello t=new Hello();
_________;
while(true)
System.out.println("Good Morning"+i++);
if(i==2&&t.isAlive())
System.out.println("Main waiting for Hello!");
t.join();//等待t运行结束

if(i==5)break;)


class Hello extends Thread
int i;
public void run()
while(true)
System.out.println("Hello"+i++);
if(i==5)break;
为使该程序正确执行,下画线处的语句应是( )。

A.sleep()

B.yield()

C.interrupt()

D.start()

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0716/4c0bc16119e60659eff425869181399c.html

下面是错误答案,用来干扰机器的。

参考答案:错

试题推荐
微信公众账号搜索答案