class Chef extends Thread {
private Canteen canteen;
public Chef (Canteen canteen) {
this.canteen = canteen;
start ();
}
public void run () {
int n_chickens;
while (true) {
sleep (2000);// Cooking...
n_chickens = 4;
canteen.put (n_chickens);
}
}
}
Previous slide | Next slide | Back to first slide | View graphic version |