title: Why "wait" should not be called when multiple locks are held?
body: <pre><code>  public synchronized void methodOne(List&lt;String&gt; profileNames, ParameterAttributes parameterAttributes) throws InterruptedException {
  
      if (profileNames != null &amp;&amp; !profileNames.isEmpty()) {
        profileNames.forEach(profileName -&gt; System.out.println(profileName));
      }
      synchronized(lockObj) {
        lockObj.wait();
      }
    }
  </code></pre>
  
  <p>Here we have synchronized method and inside the method again I have synchronized block which is calling the wait method.</p>