编译并运行以下代码的结果是?( )
import java.io.*;
public class MyThread extends Thread{
public static void main(String args[]){
MyThread mt = new MyThread();
mt.start();
}
public void run(){
try {
sleep(200);
System.out.println
("Printing from thread run() method");
} catch ( IOException e) {
}
}
}
A. 编译错误.
B. 输出: Printing from thread run() method.
C. 线程先停止运行,在 200毫秒后恢复,并输出 :
Printing from thread run() method.
D. 线程先停止运行,在恰好200毫秒后恢复。 |
|