请阅读下面程序
public class ThreadTest
public static void inain(String args[]) throws Exception
int i=0;
Hello t=new Hello();
______;
while(true)
System.out.printIn ("Good Morning"+j++);
if(i==2&&LisAlive())
System.out.printIn("Main waiting for Hello!");
T.join();//等待t运行结束
if(i==5)break;
class Hello extends Thread
int i ;
public void run()
while(true)
System.out.printIn("Hello"+i++);
if(i==5) break;
为使该程序正确执行,下画线处的语句应是______。
A.sleep()
B.yield()
C.interrupt()
D.start()
参考答案:D
解析: 本程序的ThreadTest类中新建了一个Hello线程t,并且在后面的程序中调用了线程t的方法,所以应该通过start()方法启动该线程。t.sleep()、t.yield()使处于运行状态下的线程进入阻塞状态,t.interrupt()使处于等待阻塞状态下的线程进入对象锁阻塞状态。所以正确选项应该是D。