package demo8;
import java.util.Scanner;
class Processor {
public Object lock = new Object();
public void comsumer() {
System.out.println("coming into producer");
Scanner scan = new Scanner(System.in);
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
synchronized (this) {//这里改为lock对象运行会出错,没搞明白
System.out.println("put a word to run notify() : ");
scan.nextLine();
notify();
System.out.println("after notify()");