线程的优先级

1.三种优先级

  (1)最高优先级:MAX_PRIORITY(10)

  (2)普通优先级:NORM_PRIORITY(5)

  (3)最低优先级:MIN_PRIORITY(1)

  案例代码:

public static void main(String args[]){
        //创建一个线程对象
        MyThread myThread = new MyThread();
        //设置优先级
        myThread.setPriority(Thread.MIN_PRIORITY);
        myThread.start();
    }

  

posted @ 2019-12-13 15:26  小小吸血鬼  阅读(282)  评论(0编辑  收藏  举报