全文预览

2016数媒操作系统课程设计-黄宇达2014329700042、沈宁

上传者:火锅鸡 |  格式:doc  |  页数:14 |  大小:167KB

文档介绍
turn num; Р } Р Р public void setNum(int num) Р { Р this.num = num; Р } Р Р public Storage getStorage() Р { Р return storage; Р } Р Р public void setStorage(Storage storage) Р { Р this.storage = storage; Р } Р} Рpublic class Test Р{ Р public static void main(String[] args) Р { Р // 仓库对象Р Storage storage = new Storage(); Р // 生产者对象Р Producer p1 = new Producer(storage); Р Producer p2 = new Producer(storage); Р Producer p3 = new Producer(storage); Р Producer p4 = new Producer(storage); Р Producer p5 = new Producer(storage); Р Producer p6 = new Producer(storage); Р Producer p7 = new Producer(storage); Р // 消费者对象Р Consumer c1 = new Consumer(storage); Р Consumer c2 = new Consumer(storage); Р Consumer c3 = new Consumer(storage); Р Р // 设置生产者产品生产数量Р p1.setNum(10); Р p2.setNum(10); Р p3.setNum(10);

收藏

分享

举报
下载此文档