📄 people.java
字号:
package com.lovo.zengxy.util;
public class People implements Runnable {
//public class People extends Thread {
String name;
ClassQ classq;
Thread th;
public People(String name,ClassQ classq){
this.name = name;
this.classq = classq;
th= new Thread(this,name);
th.start();
}
public void run() {
while(true){
try {
classq.play(name);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
classq.rest();
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
ClassQ classq = new ClassQ();
People p1 = new People("拳击手A",classq);
People p2 = new People("拳击手B",classq);
p1.th.setPriority(1);
p2.th.setPriority(10);
// p1.start();
// p2.start();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -