Multiple choice java

The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code.

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

These methods require owning the object's monitor lock, which only happens within synchronized code on that object. Calling them without synchronization throws IllegalMonitorStateException at runtime.