title: How to understand the wait and notify method in Java Thread?
body: <p>I'm very confusing about these two descriptions:</p>
  
  <ol>
  <li>"The wait method blocks the calling thread and gives up the monitor lock"</li>
  <li>"The notify method unblocks one waiting thread but does not give up the monitor lock"</li>
  </ol>
  
  <p>Here is my questions:</p>
  
  <ol>
  <li><p>I know each object in Java has a lock, but what is the "monitor lock" means? is it the same as the oject's lock? </p></li>
  <li><p>Why notify method needs to give up the monitor lock?</p></li>
  <li><p>If I try to make a object  waiting with the following code:</p>
  
  <pre><code>class simpleTask extends Thread
  {
      int waitingTime;
  
      public simpleTask(int waitingTime)
      {
          this.waitingTime = waitingTime;
      }
  
      public void run()
      {
          synchronized(this) // this is a reference of current object
          {
          try {
              this.wait(waitingTime);
          } catch (InterruptedException e) {
          // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  }
  </code></pre></li>
  </ol>
  
  <p>Like the first description above, is that means the the current object is blocked by synchronized keyword, and then wait method releases the lock?</p>