Multiple choice general knowledge science & technology

Which class or interface defines the wait(), notify(),and notifyAll() methods?

  1. Object

  2. Thread

  3. Runnable

  4. Class

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

The wait(), notify(), and notifyAll() methods are defined in the Object class in Java, not in Thread or Runnable. This design allows all objects to be used as locks or monitors for thread synchronization. Every object in Java inherits these methods from Object. The Thread class provides methods for thread management, while Runnable is an interface for defining thread tasks. Only Object defines these fundamental synchronization methods.