Java Thread get thread information
public class Main { public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println("Current Thread: " + t); System.out.println("Name: " + t.getName()); System.out.println("Id: " + t.getId()); System.out.println("Priority: " + t.getPriority()); System.out.println("State: " + t.getState()); System.out.println("Changing name and priority..."); t.setName("Primary"); t.setPriority(8);/*from w w w . j a va 2 s .co m*/ System.out.println("After name and priority change..."); System.out.println("Current Thread: " + t); System.out.println("Name: " + t.getName()); System.out.println("Priority: " + t.getPriority()); } }