执行start()的顺序不代表线程执行的顺序

执行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);
    }
}



全部评论

相关推荐

不会hc都被抢完了吧
投递深圳市新凯来技术等公司10个岗位
点赞 评论 收藏
分享
投递蚂蚁集团等公司10个岗位
点赞 评论 收藏
分享
09-01 11:31
门头沟学院 Java
buul:七牛云的吧,感觉想法是好的,但是大家没那么多时间弄他这个啊。。。不知道的还以为他是顶尖大厂呢还搞比赛抢hc,只能说应试者的痛苦考察方是无法理解的,他们只会想一出是一出
点赞 评论 收藏
分享
投递联想等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务