public class Father2SonsThread extends Thread
{
	public Father2SonsThread (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.");
		Father2SonsThread son1 = new Father2SonsThread("Son 1");
		System.out.println("Father: I created the first son.");
		Father2SonsThread son2 = new Father2SonsThread("Son 2");
		System.out.println("Father: I created the second son.");
		son1.start();
		System.out.println("Father: I started the first son.");
		son2.start();
		System.out.println("Father: I started the second son.");
		try
		{
			son1.join();
			System.out.println("Father: Son 1 is dead.");
			son2.join();
			System.out.println("Father: Son 2 is dead, I'm dying too.");
		}
		catch(InterruptedException e)
		{
			System.out.println("Father: InterruptedException caught when joining a son! --- " + e.toString());
		}
	}
}