class TestThread extends Thread{
public void restart(){
startMe();
}
public static void startMe(){
synchronized(TestThread.class){
TestThread.notifyAll();
System.out.println("Trying to Notify");
}
}
public void run()
{
try{
synchronized(this){
wait();
System.out.println("Notified");
}
}
catch(InterruptedException e){}
}
public static void main(
String[] args){
TestThread t1 = new TestThread();
t1.start();
t1.restart();
}
}
Why is the
thread not notified?