class UserDefineThread extends Thread
{
UserDefineThread(String name)
{
super("User Define Thread :");
start();
}
public void run()
{
try
{
for(int loop_indx = 0; loop_indx < 4; loop_indx++)
{
System.out.println((Thread.currentThread()).getName()+"Here's The Thread...");
Thread.sleep(1000);
}
}
catch (InterruptedException e1) {}
System.out.println((Thread.currentThread()).getName() + "Finshing...");
}
}
class JavaExampleisAlive
{
public static void main(String as[])
{
UserDefineThread ThrdOne = new UserDefineThread("First");
UserDefineThread ThrdTwo = new UserDefineThread("Second");
UserDefineThread ThrdThree = new UserDefineThread("Third");
UserDefineThread ThrdFour = new UserDefineThread("Fourth");
System.out.println(ThrdOne.isAlive());
try
{
ThrdOne.join();
ThrdTwo.join();
ThrdThree.join();
ThrdThree.join();
}
catch (InterruptedException e2) {}
System.out.println(ThrdOne.isAlive());
}
}