📄 thread1.java
字号:
package com.zhoutenghn;
import java.util.Date;
public class Thread1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Thread2 thread = new Thread2();
thread.start();
try {
Thread.sleep(10000);
thread.interrupt();
}catch(InterruptedException e){
}
}
}
class Thread2 extends Thread {
public void run(){
while (true){
System.out.println("时间为:"+new Date());
try {
sleep(1000);
}catch(InterruptedException e){
return;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -