Back-End/Java_1
[Java] Sleeping a thread
리딩리드
2016. 10. 7. 14:03
Sleeping a thread
- It is used to sleep a thread for the specified amount of time
1. Syntax
- public static void sleep(long miliseconds)throws InterruptedExceptioin
- public static void sleep(long miliseconds, int nanos)throws InterruptedException
2. Example
- At a time only one thread is executed
- If you sleep a thread for the specified time, the thread schedular pick up another thread