/** * Create a producer and consumer that share a Buffer. The producer * and consumer will concurrently read input from the terminal and * print it back. */ class Main { public static void main(String[] args) { /* // create and start the two threads Producer prod = new Producer(buffer); Consumer cons = new Consumer(buffer); prod.start(); cons.start(); // wait for the producer to stop reading input, and then // interrupt the consumer. try { prod.join(); cons.interrupt(); } catch (InterruptedException e) { // nothing to do here. } */ System.out.println("# End of Program"); } }