15黑马币
最佳答案import java.util.Random;
public class Demo7 {
public static void main(String[] args) {
MyRunnable1 mr = new MyRunnable1();
new Thread(mr, "窗口1").start();
new Thread(mr, "窗口2").start();
new Thread(mr, "窗口3").start();
new Thread(mr, "窗口4").start();
}
}
class MyRunnable1 implements Runnable{
private int baozi = 100;//共享资源
private boolean flag = false;
@Override
public vo ...
| |
| |
| |