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.
hi all... regarding thread ... why cant i start thread again? Thread t = new Thread() t.start(); // calls run method of this thread t.start();// while this does not call run method why its so that we can only call start method only once? thx in advance. Ajit.
Hi ajit, You must be getting IllegalThreadStateException. This is due to because java always checks for the state of a thread---whether it is running, suspended, or dead---if you do any operations when the thread is in any of the states, but that operation is illegal or senseless in that state then such exception is thrown. In your case u r trying to start a thread which is already started which is senseless, hence the exception. If u r trying to spawn 2 seperate threads then make 2 different thread class objects and call start on them seperately.