class Codeaft { public static void main(String[] args) { Thread t1=Thread.currentThread(); System.out.println("Thread Name "+t1.getName()); System.out.println("Thread Priority "+t1.getPriority()); t1.setName("My Thread"); System.out.println("Name "+t1); } }
codeaft@codeaft:~$ javac Codeaft.javacodeaft@codeaft:~$ java Codeaft Thread Name main Thread Priority 5 Name Thread[My Thread,5,main] codeaft@codeaft:~$