CurrentThread Exampale
class currentthreadex
{
public static void main(String arg[])
{
Thread th=Thread.current.Thread();
System.out.println("Current Thread Is:"+th);
th.setName("exampale thread");
System.out.println("After Name Change:"+th); //after change thread name of exampale thread
try
{
for(int i=5;i>0;i--)
{
System.out.println(i);
}
}
catch(InterruptedException h)
{
System.out.println("Main Thread Interrrupted");
}
}
}
class currentthreadex
{
public static void main(String arg[])
{
Thread th=Thread.current.Thread();
System.out.println("Current Thread Is:"+th);
th.setName("exampale thread");
System.out.println("After Name Change:"+th); //after change thread name of exampale thread
try
{
for(int i=5;i>0;i--)
{
System.out.println(i);
}
}
catch(InterruptedException h)
{
System.out.println("Main Thread Interrrupted");
}
}
}