Hello,
I am expecting the t1.start()
Thread work first. But the output show's t1.restart(); calls first. Pls let me know why the t1.start() is not calling first.
Thanks, Raghu.K
class TestThread extends Thread{
public void restart()
{
startMe();
}
public void startMe()
{
synchronized(this)
{
notifyAll();
System.out.println("Trying to notify");
}
}
public void run() {
try
{
synchronized(this)
{
wait();
System.out.println("Notify");
}
}
catch(InterruptedException e)
{}
}
public static void main(
String[] args) {
TestThread t1 = new TestThread();
t1.start();
t1.restart();
}