Multiple choice technology programming languages

Which of the following statements regarding the wait() method are correct? choose three

  1. It is an instance method of Object class.

  2. It is a static method of the Object class

  3. It is an instance method of Thread class.

  4. The Thread must have a lock on the object on which the wait() method is to be invoked

  5. An object can have only one Thread in a waiting state at a time

  6. It must be called in a synchronized code

Reveal answer Fill a bubble to check yourself
A,D,F Correct answer
Explanation

wait() is an instance method of Object class (A), must be called in synchronized context (F), and requires the calling thread to hold the object's lock (D). It's not static (B), not in Thread class (C), and multiple threads can wait on the same object (E). Three options are correct.