/**
* 关于Thread.Sleep()方法的经典题目
* @author tijian.zhou
*
*/
public class ThreadTest03 {
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new processor03());
thread.setName("线程3");
thread.start();
//重点注意这里:因为sleep方法是static静态的
//所以thread.sleep() 效果等同于 Thread.sleep();
//所以sleep300-毫秒并不影响thread线程执行
thread.sleep(3000);
}
}
class processor03 implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
for (int i = 0; i < 300; i++) {
System.out.println(Thread.currentThread().getName()+"----->"+i);
}
}
}