Thursday, October 12, 2023

Thread Priorities with program

Thread Priorities with program 

public class Tpriority extends Thread {

   public void run() {
        System.out.println("Current Thread Name: " + Thread.currentThread().getName());
        System.out.println("Current Thread Priority: " + Thread.currentThread().getPriority());
    }
    public static void main(String[] args){
        Tpriority t1 = new Tpriority();
        Tpriority t2 = new Tpriority();
        t1.setName("One");
        t2.setName("Two");
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);
        t1.start();
        t2.start();
    }
}

No comments:

Post a Comment

Machine Learning Course Assignments 2024(Dec)

 Machine Learning Course Assignments 2024 1)   Explain the concept of "generalization" in machine learning. Why is it a central go...