Answers for "write a program to assign and get thread priority in java"

0

thread priority in java

class TestMultiPriority1 extends Thread{  
 public void run(){  
   System.out.println("running thread name is:"+Thread.currentThread().getName());  
   System.out.println("running thread priority is:"+Thread.currentThread().getPriority());  
  
  }  
 public static void main(String args[]){  
  TestMultiPriority1 m1=new TestMultiPriority1();  
  TestMultiPriority1 m2=new TestMultiPriority1();  
  m1.setPriority(Thread.MIN_PRIORITY);  
  m2.setPriority(Thread.MAX_PRIORITY);  
  m1.start();  
  m2.start();  
   
 }  
}
Posted by: Guest on January-04-2021

Code answers related to "write a program to assign and get thread priority in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language