Specifications

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