}
*************************************************************************
public class MyRunable implements Runnable {
Random r = new Random();
public static int a = 1, b = 1, c = 14, d = 0;
public void print1() throws InterruptedException {
synchronized (this) {
while (a <= 100) {
ArrayList<Integer> list = new ArrayList<Integer>();
while (list.size() < 7) {
list.add(r.nextInt(32) + 1);
}
System.out.println("编号为: " + a++ + " 的员工 从" + Thread.currentThread().getName() + " 入场! 拿到的双色球彩票号码是: " + list + " " + c++);
}
}
}
public void print2() throws InterruptedException {
synchronized (this) {
while (a <= 32) {
if (b < 14) {
ArrayList<Integer> list = new ArrayList<Integer>();
while (list.size() < 7) {
list.add(r.nextInt(32) + 1);
}
System.out.println("编号为: " + a++ + " 的员工 从" + Thread.currentThread().getName() + "入场! 拿到的双色球彩票号码是: " + list + "......" + b++);