?? threada.java
字號:
package onlyfun.caterpillar;
public class ThreadA {
public static void main(String[] args) {
System.out.println("Thread A執行");
Thread threadB = new Thread(new Runnable() {
public void run() {
try {
System.out.println("Thread B開始..");
for(int i = 0; i < 5; i++) {
Thread.sleep(1000);
System.out.println("Thread B 執行..");
}
System.out.println("Thread B 即將結束..");
}
catch(InterruptedException e) {
e.printStackTrace();
}
}
});
threadB.start();
try {
// Thread B 加入 Thread A
threadB.join();
}
catch(InterruptedException e) {
e.printStackTrace();
}
System.out.println("Thread A 執行");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -