/* * °í°´ * 05. »ý¼ºÀÚ¸¦ ÀÛ¼º * 11. ·± ¸Þ¼Òµå ÀÛ¼º */ public class Customer implements Runnable { private BakerStack bs; private int num; // »§ÀÇ °¹¼ö private static int counter = 1; Customer(BakerStack s) { this.bs = s; // º¯¼ö ÃʱâÈ­ num = counter++; // »§ÀÇ °¹¼ö¸¦ Áõ°¡ } public void run() { String bread; for(int i = 0; i < 1000; i++) { bread = bs.pop(); // »§ ÁÖ¼¼¿ä //°í°´ÀÌ »ç°£ »§ Ãâ·Â System.out.println("»§»ç·¯ ¿Â³ð : "+ num + "" + bread); try { Thread.sleep((int)Math.random()*3000); } catch(InterruptedException e) { System.out.println("¾î!!! ³» »§"); } } } }