Java Threads Question:
Download Job Interview Questions and Answers PDF
Why are there separate wait and sleep methods?
Answer:
The static Thread.sleep(long) method maintains control of thread execution but delays the next action until the sleep time expires. The wait method gives up control over thread execution indefinitely so that other threads can run.
Download Java Threads Interview Questions And Answers
PDF
Previous Question | Next Question |
Why are wait(), notify() and notifyall() methods defined in the Object class? | What is the difference between Thread and Runnable types? |