In java what is the difference between sleep() and wait() .
Answer / Baljeet Singh
In Java, `sleep()` and `wait()` are methods used for pausing the execution of a thread. However, they have different purposes:
1. The `Thread.sleep()` method causes the currently executing thread to sleep (temporarily stop) for a specified amount of time.
2. The `Object.wait()` method is called by a thread to wait for a specific condition to become true. It releases the current lock on an object and causes the thread to wait until it's notified or interrupted.
| Is This Answer Correct ? | 0 Yes | 0 No |
What's the difference between local, global and universal groups? : java security
What is explicit casting?
Explain main thread under thread class execution?
Why is class forname used in java?
What is serializable in java?
What is cookie in java?
Define network programming?
What are tags in java?
When is static variable loaded? Is it at compile time or runtime? When exactly a static block is loaded in java?
What is an entity in java?
What is cloning in java?
Which type of stream is in java?