title: How do I terminate parent thread from child?
body: <p>How do I terminate the parent (main) thread from a child thread created my main? I tried System.exit(1) but it only terminate the child thread. I also tried putting a condition in main's while loop but it will obviously try to read 1 extra input before exiting.</p>
  
  <pre><code>public static void main(String[] args) throws IOException
  {
      new Thread(new Runnable() 
      { 
        public void run() 
        { 
          while(true) 
          { 
              //meet a condition then terminate
          } 
        } 
      }).start(); 
      while (true)
      {
          String a = input.nextLine();
          //do something with input
      }
  }
  </code></pre>