When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?



When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquire..

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

Post New Answer

More Core Java Interview Questions

How to sort an array in java without using sort method?

1 Answers  


Why java is not a pure object oriented language?

5 Answers   IBM,


What is a ternary operator in java? What is an interface?

1 Answers  


What are reference variables in java?

1 Answers  


How we can execute any code even before main method?

1 Answers  


What is structure of java heap? What is perm gen space in heap?

1 Answers  


Why hashset is used in java?

1 Answers  


How to perform selection sort in java?

1 Answers  


When to use runnable interface vs thread class in java?

1 Answers  


Is call by reference possible in java?

1 Answers  


How will you override default serialization mechanism in java

2 Answers  


Can we sort arraylist in java?

1 Answers  


Categories