what is the difference between sleep() and Wait()?
Answer Posted / tisty
Simply speaking, we will use sleep() for pausing a thread
intentionally for some amount of time which we mentions in
milliseconds as the argument of sleep() method and,
wait() method is used whenever there is a communication is
needed between the threads, say if one thread's execution
is depended on the the execution of others.
The thread went on sleep will continue its execution after
the timeperiod. on the other hand, the thread undergone
wait will get activated on a notify() or notifyall() method.
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
Which is better ascii or unicode?
Compare java and python.
What is a generic data type?
What is an immutable class? How to create an immutable class?
What is the difference between compiler and jvm?
Is java still necessary?
Explain the polymorphism principle?
Describe the term diamond problem.
What is += mean in java?
What is the difference between a synchronized method and a synchronized block?
What do you mean by exception handling in Java?
What are pass by reference and pass by value?
Explain about static nested classes in java?
Can we make the abstract methods static in java?
What environment variables are required to be set on a machine in order to run Java programs?