Viewing code of CurrentThreadDemo
// ------ ../cgi-bin/java/CurrentThreadDemo.java --------------
//--- Programmed By Rajesh -----


public class CurrentThreadDemo{
public static void main(String arg[]){
Thread t=Thread.currentThread();
System.out.println("current Thread:"+t);
t.setName("My First Thread");
System.out.println("After name change:"+t);

try{
for(int i=0;i<5;++i){
System.out.println(i);
Thread.sleep(1000);
}
}
catch (InterruptedException e){
System.out.println("main Thread Intrrupted.");
}
}
}