?? threadinterrupt.java
字號:
public class ThreadInterrupt extends Thread{
public void run(){
long startTime = System.currentTimeMillis();
System.out.println("準備開始sleep");
try {
Thread.sleep(2000);
} catch ( InterruptedException x ) {
System.out.println("線程被打斷了");
}
System.out.println("線程運行時間: "+ (System.currentTimeMillis() - startTime));
}
public static void main(String[] args) {
ThreadInterrupt tt = new ThreadInterrupt();
tt.start();
tt.interrupt();
System.out.println("主線程執行完");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -