执行start()的顺序不代表线程执行的顺序
import org.omg.CORBA.PUBLIC_MEMBER;
/**
* Created by wuyupku on 2019-04-12 12:24
*
* @Beijing CHINA
*/
public class Demo01 {
public static void main(String[] args) {
mythread thread1 = new mythread(1);
mythread thread2 = new mythread(2);
mythread thread3 = new mythread(3);
mythread thread4 = new mythread(4);
thread1.start();
thread2.start();
thread3.start();
thread4.start();
System.out.println("运行结束");
}
}
class mythread extends Thread{
private int i;
public mythread(int i){
super();
this.i = i;
}
@Override
public void run(){
super.run();
System.out.println(i);
}
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有