public class FatherSonThread extends Thread
{
	public FatherSonThread (String name)
	{
		super(name);
	}
	
	public void run ()
	{
		System.out.println(getName() + ": I just started, now I'm dying.");
	}
	
	public static void main (String[] args)
	{
		System.out.println("Father: I just started.");
		FatherSonThread son = new FatherSonThread("Son");
		System.out.println("Father: I created a son.");
		son.start();
		System.out.println("Father: I started the son.");
		if (son.isAlive())
		{
			System.out.println("Father: Son is still alive.");
		}
		else
		{
			System.out.println("Father: Son is already dead.");
		}
		try
		{
			son.join();
			System.out.println("Father: Son is dead, I'm dying too.");
		}
		catch(InterruptedException e)
		{
                        // Must be handled!
			System.out.println("Father: InterruptedException caught when joining son! --- " + e.toString());
		}
	}
}