class Phil extends Thread {
private int id;
private Canteen canteen;
public Phil(int id, Canteen canteen) {
this.id = id;
this.canteen = canteen;
start ();
}
public void run() {
int chicken;
while (true) {
if (id > 0) {
sleep(3000); // Thinking...
}
chicken = canteen.get(id);// Gotta eat...
} // mmm...That's good
} }
Previous slide | Next slide | Back to first slide | View graphic version |