PPT Slide
class Producer extends Thread {
Producer(Buffer buf)
{
buffer = buf;
}
public void run()
{
System.out.println("Producer started.");
for(int i=0; i ++i){
// code to produce a value here
buffer.put(i); // let i be the produced value
}
System.out.println("Producer is finished.");
}
private Buffer buffer;
}
Previous slide
Next slide
Back to first slide
View graphic version