title: Calling notify on a regular Object in Java
body: <p>Consider this snippet of code:</p>
  
  <pre><code>Object stateChanged = new Object();
  if(state == GLGameState.Finished) {
   //Don't mind those two methods
   screen.pause();
   screen.dispose();
   synchronized(stateChanged) {
   this.state = GLGameState.Idle;
   stateChanged.notifyAll();
       }
   } 
  </code></pre>
  
  <p>I'm a bit confused because I have never seen notifyAll/wait called on any object before. How does this work? Before this, I haven't seen anything to make it wait. This is a snippet from the book, Beginning Android Games. I'm not sure if this snippet is enough, but if it is not please let me know. TLDR how does notifyall, notify, and wait work when calling it on an object? All the tutorials I've seen just call wait() or notify() on themselves. Thank you in advance! Edit: Do note that there was no wait() called on stateChanged so far, so that confuses me a bit too.</p>
  
  <pre><code>
  </code></pre>