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

Popular posts from this blog

Create an android app that demonstrates Activity Lifecycle and Instance State.

Program using Light Sensitive Sensors on Tinkercad