How do we specify pause times in my program?
- Using the sleep function in Java, the thread’s execution can be put on hold. During this pause session, the thread does not loose ownership of the monitors.
-
Syntax:
Public static void sleep(long millis)
Throws InterruptedExecution
- Here, millis is the time in mili seconds to hold the threads execution.