When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?
Answer / Sumit Batham
The wait(), notify(), and notifyAll() methods in Java are used for thread synchronization. When a thread calls the wait() method, it releases the lock on the object, goes into waiting state, and allows another thread to acquire the lock. The notify() method wakes up one waiting thread, and notifyAll() wakes up all waiting threads.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to sort an array in java without using sort method?
Why java is not a pure object oriented language?
What is a ternary operator in java? What is an interface?
What are reference variables in java?
How we can execute any code even before main method?
What is structure of java heap? What is perm gen space in heap?
Why hashset is used in java?
How to perform selection sort in java?
When to use runnable interface vs thread class in java?
Is call by reference possible in java?
How will you override default serialization mechanism in java
Can we sort arraylist in java?