/**
  * Two threads share a sum variable to which both add numbers repeatedly.
  * Unless synchronization is used, race conditions (lost updates) are
  * possible.
  *
  */
class IntensiveSumMain {

   /**
	 * Main method for running two threads for summation
	 */
   public static void main(String[] args) {
	  // try RACE CONDITION first
	  // without sync the sum method
	  IntensiveSumRC is = new IntensiveSumRC(2000);
	  Thread t1 = new Thread(is);
	  Thread t2 = new Thread(is);
	  t1.start();
	  t2.start();
	  try { 
			t1.join();  
			t2.join();
	  }
	  catch (InterruptedException e) { 
			// do nothing	
	  }
   }
}