Setting Thread Name using JAVA

Here is the Java code to set the thread name. 
  1. public class Demo {  
  2.     public static void main(String[] args) {  
  3.         //get currently running thread object  
  4.         Thread currentThread = Thread.currentThread();  
  5.         System.out.println(currentThread);  
  6.         currentThread.setName("Green Thread :)");  
  7.         System.out.print("Thread Name is set to: ");  
  8.         System.out.println(currentThread.getName());  
  9.     }  
  10. }  
Thank you, keep learning and sharing.