However, the output is only "Trying to Notify".
Please explain why so?
Calling the start() method, will create a new
thread that will eventually call the run() method. But there is no guarantee that it will call the run() method right away.
In your case, if the main thread returns from the start() method, and calls the restart() method, before the run() method runs, then the notifyAll() will be called before the newly created thread calls wait(). The notification sent by the main thread is lost.
Henry