synchronized (lock) {
//lock.notifyAll();
new Thread(() -> {
System.out.println("同步代码块中创建线程...");
try {
lock.wait();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
}
In this code : throw exception "IllegalMonitorStateException.