title: will main thread exit before child threads complete execution?
body: <p>will main thread exit before child threads complete execution?</p>
  
  <p>i read in 2 articles  </p>
  
  <p><a href="http://www.cs.mtu.edu/~shene/NSF-3/e-Book/FUNDAMENTALS/thread-management.html" rel="noreferrer">http://www.cs.mtu.edu/~shene/NSF-3/e-Book/FUNDAMENTALS/thread-management.html</a></p>
  
  <p>in the above article, In "Thread Termination" para, it states in Red " if the parent thread terminates, all of its child threads terminate as well."</p>
  
  <p><a href="http://www.roseindia.net/java/thread/overview-of-thread.shtml" rel="noreferrer">http://www.roseindia.net/java/thread/overview-of-thread.shtml</a></p>
  
  <p>in the above article, the last line in that page states "The main() method execution can finish, but the program will keep running until the all threads have complete its execution.". </p>
  
  <p>i fee they are contradictory. if i am wrong, Please experts correct me. </p>
  
  <p>In my program, a program with Main method calls the constructor of 2 threads . in the constructor of the respective threads, i am having the start() method . </p>
  
  <pre><code>     TestA  A = new TestA("TestA");
       TestB  B = new TestB("TestB");
  
       public TestA(String name) {
      System.out.println(name);
      t = new Thread(this);
      t.start();
  }
  </code></pre>
  
  <p>i would like to know what happens, main thread terminates before child threads complete execution? if so, will the child threads anyway, continue their execution??</p>
  
  <p>i tried running the program, some times all the child threads are getting executed complete  even if the main thread exits. 
  In the 2 threads , i am processing some files. in testA thread A alone, 1 file alone is not getting processed some times. but many times, all the files are getting processed and i do not have any issues. </p>