📄 joinmethoddemo.java
字号:
package chapter13;
public class JoinMethodDemo extends Thread {
public JoinMethodDemo(String name) {
super(name);
}
public static void main(String args[]) throws Exception {
JoinMethodDemo thread1 = new JoinMethodDemo("线程1");
JoinMethodDemo thread2 = new JoinMethodDemo("线程2");
thread2.setPriority(6);
thread1.start();
try {
thread1.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
thread2.start();
}
public void run() {
for (int i = 0; i < 3; i++) {
System.out.println(getName());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -