Java Programming - Threads
Exercise : Threads - Pointing out the correct statements
- Threads - General Questions
- Threads - Finding the output
- Threads - Pointing out the correct statements
6.
Which statement is true?
Answer: Option
Explanation:
Option A is correct because the notifyAll() method (along with wait() and notify()) must always be called from within a synchronized context.
Option B is incorrect because to call wait(), the thread must own the lock on the object that wait() is being invoked on, not the other way around.
Option C is wrong because notify() is defined in java.lang.Object.
Option D is wrong because notify() will not cause a thread to release its locks. The thread can only release its locks by exiting the synchronized code.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers