package state;
public class TestPoriority {
public static void main(String[] args) {
MyPoriority myPoriority = new MyPoriority();
Thread t1 = new Thread(myPoriority);
Thread t2 = new Thread(myPoriority);
Thread t3 = new Thread(myPoriority);
Thread t4 = new Thread(myPoriority);
t1.start();
t2.setPriority(1);
t2.start();
t3.setPriority(4);
t3.start();
t3.setPriority(Thread.MAX_PRIORITY);
t4.start();
System.out.println(Thread.currentThread().getName()+"---"+Thread.currentThread().getState());
}
}
class MyPoriority implements Runnable{
@Override
public void run() {
System.out.println(Thread.currentThread().getName()+"---"+Thread.currentThread().getState());
}
}
标签:优先级,Thread,currentThread,myPoriority,t3,start,线程,new
From: https://www.cnblogs.com/qt0312/p/17204948.html