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
What are the features of junit?
What do you mean by checked exceptions?
What is the meaning of nullable?
Can a abstract class be defined without any abstract methods?
Why do we use variables?
Can we override data members in java?
How do we access static members in java?
What is the purpose of format function?
What is the purpose of a volatile variable?
Write a program based on Java script program.
What is a final class in java?
Can we use return in constructor?
what is meant by abstract class?
What is the benefit of using enum to declare a constant?
What is character in data type?