package com.prj;
public class TestPriority extends Thread {
public static void main(String[] args) {
System.out.println(Thread.currentThread().getName()+"-->"+Thread.currentThread().getPriority());
MyPriority mypty=new MyPriority();
Thread t1=new Thread(mypty);
Thread t2=new Thread(mypty);
Thread t3=new Thread(mypty);
Thread t4=new Thread(mypty);
Thread t5=new Thread(mypty);
t1.start();
t2.setPriority(1);
t2.start();
t3.setPriority(2);
t3.start();
t4.setPriority(8);
t4.start();
t5.setPriority(10);
t5.start();
}
}
class MyPriority implements Runnable{
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println(Thread.currentThread().getName()+"-->"+Thread.currentThread().getPriority());
}
}