Hi, having read some of the other posts I am not sure which method to use. I want to be able to pause running through some code for 1000ms and then restart. I have two methods, one running straight after the other. I would like to be able to delay starting the 2nd method for a short period.
Difference in these APIs is that Thread.speep(long millis) causes to sleep the current thread for given period of time. It does not release the monitor which it has been aquired.. While Thread.wait(long millis) causes to wait for given period of time or will also exit from wait condn if any other thread calls Thread.notify() or Thread.notifyAll() on the same object on which this thread is synchronized. Also it releases the monitor that it has aquired. Now in your case as you just want to pause the current thread for particular period of time should use Thread.speep(1000).