This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
How can i start multiple threads ( number of threads to start is not defined)? For instance Thread t1 = new Thread("One"); Thread t2 = new Thread("Two"); t1.start(); t2.start(); t1.join(); t2.join();
In this case the main thread will wait for both t1 & t2 to exit the run method. Here i can code the way given above coz it is know that there are 2 threads. But in case the number of threads to be started is dynamic, how do i go about that?