Files
javaSE-0113/javaSE-day06/src/com/inmind/wait_notify08/Demo09.java

16 lines
619 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.wait_notify08;
//测试类:创建包子,包子铺,吃货线程,让子线程运行起来
public class Demo09 {
public static void main(String[] args) {
BaoZi baoZi = new BaoZi();//被包子铺,吃货线程共享,用来进行线程间通信
//创建2个线程任务来实现2个线程按照我们所需的顺序来执行一定是先有包子再吃
BaoZiPu baoZiPu = new BaoZiPu(baoZi);
ChiHuo chiHuo = new ChiHuo(baoZi);
new Thread(baoZiPu).start();
new Thread(chiHuo).start();
System.out.println("程序结束");
}
}