class T3
{
public static void main(
String[] args)
{
T2 t2 = new T2();
t2.start();
System.out.println("hmm");
}
}
public class T1 extends Thread
{
public synchronized void run()
{
while(true)
{
System.out.println("t1 run start");
try
{
System.out.println("t1 wait");
wait();
}
catch(InterruptedException e)
{
System.out.println("e");
}
System.out.println("t1 woke up..............");
}
}
}
class T2 extends Thread
{
T1 t1;
public synchronized void run()
{
t1 = null;
while(true)
{
System.out.println("t2 run start");
try
{
t1 = new T1();
t1.start();
sleep(500);
}
catch(InterruptedException e)
{
}
System.out.println("invoke the t1 thread!!");
synchronized(t1)
{
t1.notifyAll();
}
}
}
}