}
}
}
//定义消费者线程
class Customer implements Runnable{
private Student s;
Customer(Student s){this.s=s;}
public void run(){
while(true)
s.get();
}
}
public class ThreadDemo1 {
public static void main(String[] args) {
Student s = new Student();
new Thread(new Product(s)).start();
new Thread(new Customer(s)).start();
}
}