// in PCExample.java

// javac PCExample.java
// java PCExample

public class PCExample {
    public static void main(String[] args) {
	SharedN nobj = new SharedN();  // create shared object
	PCThread thrP = new PCThread("P", nobj); // create producer thread
	PCThread thrC = new PCThread("C", nobj); // create consumer thread
	
	thrP.start();		// start producer thread
	thrC.start();		// start consumer thread
	try {
	    thrP.join();		// wait for producer to finish
	    thrC.join();		// wait for consumer to finish
	} catch (InterruptedException e) {
	    System.out.println("Join interrupted");
	}
    }
}

