////// WordCount.java ////// class WordCount { public static void main(String args[]) { Cirbuf buf = new Cirbuf(); Producer pd = new Producer(buf); Consumer cs = new Consumer(buf); pd.start(); // producer thread now running cs.start(); // consumer thread now running try { pd.join(); cs.join(); } catch(InterruptedException e) { } System.out.println("total " + cs.count() + " words"); } }