7 B. Write a java program to implement thread life cycle.
Program :
class Pract7b
{
public static void main(String args[])
{
System.out.println(Thread.currentThread().getName());
for(int i=0;i<10;i++)
{
new Thread(""+i)
{
public void run()
{
System.out.println("Thread:"+getName()+"running");
}
}.start();
}
}
}
Comments
Post a Comment