Hi Saket
A sleep() method would cause a thread to sleep() for a specified amount of time. There is no sleep() method that doesn't takes any argument. So you will have to specify the timeout. Now in case you wish get the same functionality as of the the join() method you will have to specify the time atleast equal to or greater than the time of the other thread which you want should complete. You can not be sure how long it takes each time and on each platform. Hence a join() method seems a better option. One more thing
From what I understand, calling join on a thread t from methodA() will make the methodA() sleep until the thread t's execution is done.
Calling join on a thread t from methodA() will
not make the methodA() sleep but will make the thread executing methodA() sleep until the thread t's execution is done.
then the same functionality can be (more or less) implemented by calling the sleep method directly on the method whose execution we want to temporarily suspend.
Similarly sleep is a Thread class method a will make a Thread( or its subclass) object to goto sleep. So the above sentenced would be better worded as "then the same functionality can be (more or less) implemented by calling the sleep method directly on the
Thread class object's(or its subclass) whose execution we want to temporarily suspend."
[ May 24, 2003: Message edited by: Anupam Sinha ]