62,614
社区成员
发帖
与我相关
我的任务
分享
public class MultiThreadTest extends Thread{
public void timeThread(long startTime) {
long currentTime = System.currentTimeMillis();
long costTime = currentTime - startTime;
System.out.println("开始到现在共花了: " + costTime + "毫秒");
}
public void msgThread1(long startTime) {
System.out.println("这是一个每隔15秒发送消息的线程");
}
public void msgThread2(long startTime) {
//this.wait(700);
System.out.println("这是一个每隔7秒发送消息的线程");
}
public void run() {
}
public static void main(String[] args) {
Thread t1 = new Thread("msg-thread1");
Thread t2 = new Thread("msg-thread1");
Thread t3 = new Thread("msg-thread1");
t1.start();
t2.start();
t3.start();
}
}