class ThDemo extends Thread { public void run() { System.out.println("Priority of thread is: "+Thread.currentThread().getPriority()); } } public class Demp3 { public static void main(String args[]) { ThDemo d1=new ThDemo(); d1.setPriority(Thread.MIN_PRIORITY); d1.start(); } }
Priority of thread is: 1
class ThDemo extends Thread { public void run() { System.out.println("Priority of thread is: "+Thread.currentThread().getPriority()); } } public class Demp3 { public static void main(String args[]) { ThDemo d1=new ThDemo(); d1.setPriority(Thread.NORM_PRIORITY); d1.start(); } }
Priority of thread is: 5
class ThDemo extends Thread { public void run() { System.out.println("Priority of thread is: "+Thread.currentThread().getPriority()); } } public class Main { public static void main(String args[]) { ThDemo d1=new ThDemo(); d1.setPriority(Thread.MAX_PRIORITY); d1.start(); } }
Priority of thread is: 10