class MyThread implements Runnable {
public void run() {
try {
System.out.println("Thread ID:" + Thread.currentThread().getId());
} catch (Exception e) {
System.out.println("Exception: " + e);
}
}
}
public class Program {
public static void main(String[] args) {
Thread trd1 = new Thread(new MyThread());
Thread trd2 = new Thread(new MyThread());
Thread trd3 = new Thread(new MyThread());
System.out.println("Thread Priority: " + trd1.getPriority());
System.out.println("Thread Priority: " + trd2.getPriority());
System.out.println("Thread Priority: " + trd3.getPriority());
trd1.start();
trd2.start();
trd3.start();
}
}
/*
run:
Thread Priority: 5
Thread Priority: 5
Thread Priority: 5
Thread ID:16
Thread ID:17
Thread ID:15
*/