Explain wait(), notify() and notifyall() methods of object class ?



Explain wait(), notify() and notifyall() methods of object class ?..

Answer / Priyanka Prajapati

In Java, the 'wait()', 'notify()', and 'notifyAll()' methods are used for inter-thread communication. An object's monitor (synchronization lock) is associated with these methods to control access to critical sections of code. The 'wait()' method causes the current thread to wait until it is notified by another thread, while 'notify()' and 'notifyAll()' allow other waiting threads to resume execution.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

why an outer class cannot be declared as private?

2 Answers  


What is the reason behind using constructors and destructors?

1 Answers   HCL,


What is remote method invocation (rmi)?

1 Answers  


How many bits are in a sentence?

1 Answers  


Explain all java features with real time examples

1 Answers  


What are byte codes?

1 Answers  


How many types of operators are there?

1 Answers  


What is a constructor, constructor overloading in java?

1 Answers  


What is the difference between throw and throws? What is the similarity between try and throw?

2 Answers  


What is internal iteration in java se 8?

1 Answers  


Is java hashset ordered?

1 Answers  


Differentiate between a constructor and a method? Can we mark constructors final?

1 Answers  


Categories