declaring relevant objects as static volatile so that other threads know about the state change without calling these methods?
The goal of static and volatile is completely different from the wait expectation mechanism provided by threads when a state changes or a condition is met.
Static - indicates that the field / method is associated with the class, not the instance level, and does not need to create an object to use them.
Volatile - instructs the JVM to always read the last value of this field, that is, it guarantees the visibility of changes in variable variables in all threads and avoids problems with cache coherency.
Waiting and notifying, this is the communication mechanism used by threads, and we will see it from the example of the producer-consumer.
The producer queues tasks that should be consumed / performed by the user.
Start with a scenario in which the consumer expects the task to appear in the queue (empty queue). The manufacturer sets tasks and then notifies any expecting consumer. This awakens the consumer and begins processing tasks. Without this, the consumer must continue to poll the queue for the task.
From the end of the producer, he continues to queue the tasks until the queue is full, and then the producer waits until the space becomes available in the queue. The consumer as he raises the task and makes some free space in the queue, can notify the manufacturer. Without this producer, you periodically need to periodically check the queue for free space.
Thus, wait-notify are communication mechanisms that use threads to communicate with each other for any state / state changes.
In addition, with waiting and notification, JMM provides a guarantee of memory visibility that occurs before the relationship.
Similarly, JMM guarantees writing to the volatile field - before each subsequent reading of this field, but do not confuse it with the wait-notify mechanism provided by threads.
Below is the image of the Java revisited link , which displays the producer-consumer pattern using wait wait. Green dashed lines that call notification methods to wake pending threads when the condition is met. You can follow the link if you are interested in the corresponding code.
