title: Thread.join() equivalent in executor
body: <p>I have a newbie question. I have this code:</p>
  
  <pre><code>public class Main 
  {
  
      public static void main(String[] args) throws InterruptedException 
      {
          // TODO Auto-generated method stub
          IntHolder aHolder=new IntHolder();
          aHolder.Number=0;
  
          IncrementorThread A= new IncrementorThread(1, aHolder);
          IncrementorThread B= new IncrementorThread(2, aHolder);
          IncrementorThread C= new IncrementorThread(3, aHolder);
  
          A.start();
          B.start();
          C.start();
  
          A.join();
          B.join();
          C.join();
          System.out.println("All threads completed...");
  
      }
  
  }
  </code></pre>
  
  <p>Which will wait for all threads to complete. If I use <code>Executors</code> like this:</p>
  
  <pre><code>public class Main 
  {
  
      public static void main(String[] args) 
      {
          // TODO Auto-generated method stub
          IntHolder aHolder=new IntHolder();
          aHolder.number=0;
  
          IncrementalRunable A= new IncrementalRunable(1, aHolder);
          IncrementalRunable B= new IncrementalRunable(2, aHolder);
          IncrementalRunable C= new IncrementalRunable(3, aHolder);
  
          ExecutorService exec = Executors.newFixedThreadPool(3);
          exec.execute(A);
          exec.execute(B);
          exec.execute(C);
          //Don't know what to do here
  
          System.out.println("All threads completed...");
      }
  }
  </code></pre>
  
  <p>How can I suspend the main thread to wait for all the threads in the executor to finish, i.e the "All threads completed..." should be printed after the all the threads have done their work?</p>