spawnining more threads
<p>I have developed a program in which the thread A waits for Thread B to complete it task and when thread B finishes its task it makes notfiy()  to thread A to continue onwards..below is the code..</p>

<pre><code>    class ThreadA {
 public static void main(String [] args) {
 ThreadB b = new ThreadB();
 b.start();

 synchronized(b) {
 try {
 System.out.println("Waiting for b to complete...");
 b.wait();
} catch (InterruptedException e) {}
System.out.println("Total is: " + b.totals);
 }
}
}


class ThreadB extends Thread {
public  int totals;

 public void run() {
     synchronized(this) { //instance level lock
     for(int i=0;i&lt;100;i++) {
      totals += i;
      }
      notify();
      }
      }


}
</code></pre>

<p>Now I want lets say 3 more thread are waiting for thread b , so please advise me how to spawn 3 more threads , just like thread A is waiting , please advise.</p>
