public void run() {
   for (int i = 0; i < 20; i++) {
     Apple apple = new Apple(i);
     ss.push(apple);
     System.out.println("produce " + apple);
   }
 }
Beispiel #2
0
 public void run() {
   for (int i = 0; i < 20; i++) {
     char c = stack.pop();
     System.out.println("��ѣ�" + c);
     try {
       Thread.sleep((int) (Math.random() * 1000));
     } catch (InterruptedException e) {
     }
   }
 }
Beispiel #3
0
 public void run() {
   for (int i = 0; i < 20; i++) {
     char c = (char) (Math.random() * 26 + 'A');
     stack.push(c);
     System.out.println("produced��" + c);
     try {
       Thread.sleep((int) (Math.random() * 1000));
     } catch (InterruptedException e) {
     }
   }
 }
 public void run() {
   for (int i = 0; i < 20; i++) {
     Apple apple = ss.pop();
     System.out.println("consume " + apple);
   }
 }