单项选择题 (2005年4月二级考试)

下列程序的功能是在监控台上每隔一秒钟显示一个字符串“Hello”,能够填写在程序中下划线位置,使程序完整并能正确运行的语句是【 】

public class Test implements Runnable{
   public static void main(String args[]){
      Test t=new Test();
      Thread tt=new Thread(t);
      tt.start();
   }
   public void run(){
      for(;;){
         try{}catch(e){}
         System.put.println("Hello");
      }
   }
}

A、sleep(1) RuntimeException

B、sleep(1000) InterruptedException

C、Thread.sleep(1) InterruptedException

D、Thread.sleep(1000) InterruptedException

参考答案

关键词

异常;thread;语句;test;程序;多线程;子类;new;public;