title: IllegalMonitorStateException: object not locked by thread before notify()
body: <p>Yes, I have seen previous questions on similar topics, but they don't seem to help me. If there is a duplicate, please point me to the question, thanks</p>
  
  <p>I have two problems here, the first one is the title problem:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
  //Starts up method1 &amp; method2 in a try-catch
      try{
          method1();
          method2();
          new CountDownLatch(1);
          CountDownLatch.await();
      }catch(InterruptedException e){
          // TODO Auto-generated catch
          // block
          e.printStackTrace();
      }
  //This Toast should only run after notify() is called
      Toast.makeText(firstClass.this, "This is toasty", Toast.LENGTH_SHORT).show();
  }
  
  
  //Start of method 1, which is currently useless
  public void method1() throws InterruptedException{
  //Creates new thread
      Thread thread = new Thread(new Runnable(){
          @Override
          public void run(){
              try{
                  synchronized(SecondClass.this){
                  }
              }catch(Exception e){
                  e.printStackTrace();
              }
          }
  
      });
      thread.start();
  }
  
  public void method2(){
      Thread thread2 = new Thread(new Runnable(){
          @Override
          public void run(){
  
  //Sets a button, when the button is clicked, then the code is continued
                  final Button bNext = (Button) findViewById(R.id.bIsoAbunSave);
                  bNext.setOnClickListener(new OnClickListener(){
                      @Override
                      public void onClick(View arg0){
                          synchronized(SecondClass.this){
                          CountDownLatch.countDown();
                         }
                      }
                  });
              }
  
  
      });
      thread2.start();
  }
  </code></pre>
  
  <p>From what I understand, please correct me if its false, what wait() does is it halts all running code until an event, such as a click of a button causes notify() to be called.</p>
  
  <p>The second problem is even before I click the button, the Toast shows up. I assumed when I called wait(), all code would <em>wait</em> until I clicked the button, where notify() would be called and the code would be continued. But what happens instead is that the Toast is seemingly ignoring the wait() and running anyways.</p>
  
  <p>If there are any questions, please ask away, thanks.</p>
  
  <p>EDIT: The logcat message shows that the crash happens at:  </p>
  
  <pre><code>synchronized(SecondClass.this){notify();}
  </code></pre>