-->
当前位置:首页 > 题库 > 正文内容

单选题:以下Java程序的功能是在监控台上每隔1秒左右显示当前时间,请选择合适的答案填空。

Luz4年前 (2021-12-25)题库392
以下Java程序的功能是在监控台上每隔1秒左右显示当前时间,请选择合适的答案填空。

import java.util.Date;
class DisplayTime implements Runnable {
public static void main(String[] args){
DisplayTime t=new DisplayTime();
Thread tt=new Thread(t);
tt.start();
}
public void run(){
for(;;){
try {
____________________;
}catch(InterruptedException e){e.printStackTrace();}
System.out.println(_______________);
}
}
}




A.Thread.sleep(1)<br>
new Date()
B.Thread.sleep(1000)<br>
new Date()
C.Thread.sleep(1)<br>
new Time()
D.Thread.sleep(1000)<br>
new Time()


答案:B

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。