Specifications

Sun Services
Java™ Programming Language
Module 13, slide 32 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
The Consumer Class
13 public void run() {
14 char c;
15 for (int i = 0; i < 200; i++) {
16 c = theStack.pop();
17 System.out.println(“Consumer” + num + “: “ + c);
18
19 try {
20 Thread.sleep((int)(Math.random() * 300));
21 } catch (InterruptedException e) {
22 // ignore it
23 }
24 }
25 } // END run method
26