class ThreadDemo
{
public static void main(String main[])
{
Thread t=Thread.currentThread();
System.out.println("Current Thread : "+t);
//change the name of the thread
t.setName("My thread");
System.out.println("Current Thread after name changed : "+t);
System.out.println("Number of active threads : "+t.activeCount());
}
}
{
public static void main(String main[])
{
Thread t=Thread.currentThread();
System.out.println("Current Thread : "+t);
//change the name of the thread
t.setName("My thread");
System.out.println("Current Thread after name changed : "+t);
System.out.println("Number of active threads : "+t.activeCount());
}
}
0 comments:
Post a Comment