title: Creating more threads than requested
body: <p>I am writing a multi threaded client program which listens for a connection which comes from the web browser.My problem is more threads are created than should be.For e.g if i type in a url in the browser ,Just one thread should be created but in my case ,multiple threads are created.</p>
  
  <pre><code>public void running() {
  
      try {
          for(;;){
          Socket socket=server.accept();
          Thread t= new Thread( new ClientHandler(socket));
          t.start();
           // calls the start method to start a thread which also starts the run method
          System.out.println("Thread id is " +t.getId() );}
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
  }
               public static void main(String[] args) {
  
      Server server= new Server();
      server.running();
  }
   }
  </code></pre>