Thread.sleep

Thread.sleep

Class Overview | Class Members | This Package | All Packages

Syntax 1
public static native void sleep( long millis ) throws InterruptedException
Parameters
millis
the length of time to sleep in milliseconds.
Description
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. The thread does not lose ownership of any monitors.

Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify



Syntax 2
public static void sleep( long millis, int nanos ) throws InterruptedException
Parameters
millis
the length of time to sleep in milliseconds.
nanos
0-999999 additional nanoseconds to sleep.
Description
Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds. The thread does not lose ownership of any monitors.

Exceptions
IllegalArgumentException if the value of millis is negative or the value of nanos is not in the range 0-999999.
Exceptions
InterruptedException if another thread has interrupted this thread.
See Also
notify