class ThreadNaming extends Thread {
ThreadNaming(String threadName) {
super(threadName);
}
public void run() {
System.out.println("Thread is running");
}
}
public class NamingThread {
public static void main(String[] args) {
ThreadNaming tn1 = new ThreadNaming("java");
ThreadNaming tn2 = new ThreadNaming("Invent");
System.out.println("Thread th1 name : " + tn1.getName());
System.out.println("Thread th2 name : " + tn2.getName());
System.out.println("Thread th1 id : " + tn1.getId());
System.out.println("Thread th2 id : " + tn2.getId());
System.out.println(
"Thread main Priority : " + Thread.currentThread().getPriority()
);
System.out.println("Thread th1 : " + tn1.getPriority());
System.out.println("Thread th2 : " + tn2.getPriority());
}
}