Difficulty: Easy
Correct Answer: Object
Explanation:
Introduction / Context:
Java’s built-in monitor mechanism associates a lock with every object. The fundamental coordination methods are therefore defined where the lock lives: on java.lang.Object.
Given Data / Assumptions:
wait()
, notify()
, and notifyAll()
.
Concept / Approach:
Each Java object has a monitor. The methods that wait on or signal that monitor are instance methods of Object. Threads interact with these methods by synchronizing on the object whose monitor they are using. Thread provides lifecycle and scheduling methods (start
, sleep
, join
, yield
, interrupt
) but does not declare wait
/notify
.
Step-by-Step Solution:
wait()
, wait(long)
, wait(long, int)
, notify()
, and notifyAll()
.Check Thread → none of those methods are declared there.Check Runnable, Class, ThreadGroup → none declare these monitor methods.
Verification / Alternative check:
Review Javadoc for Object and Thread to confirm method ownership and usage patterns.
Why Other Options Are Wrong:
They are either interfaces or classes serving other purposes and do not contain the monitor APIs.
Common Pitfalls:
Assuming thread coordination methods belong to Thread; they are bound to the object whose monitor you use.
Final Answer:
Object
Discussion & Comments