Thread Priorities with program
public class Tpriority extends Thread {
public void run() {System.out.println("Current Thread Name: " + Thread.currentThread().
System.out.println("Current Thread Priority: " + Thread.currentThread().
}
public static void main(String[] args){
Tpriority t1 = new Tpriority();
Tpriority t2 = new Tpriority();
t1.setName("One");
t2.setName("Two");
t1.setPriority(Thread.MAX_
t2.setPriority(Thread.MIN_
t1.start();
t2.start();
}
}
No comments:
Post a Comment