📄 notifyexample.java
字号:
public class NotifyExample implements Runnable
{
public synchronized void startWaiting()
{
try
{
System.out.println("Thread starting to wait. " + Thread.currentThread());
wait();
System.out.println("Thread just notified to wake up. " + Thread.currentThread());
} catch (InterruptedException e){ }
}
public void run()
{
startWaiting();
}
public synchronized void wakeUpAll()
{
notifyAll();
}
public synchronized void wakeUp()
{
notify();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -