title: Cannot invoke equals(boolean) on the primitive type boolean
body: <p>I want to check equality of first and last two characters of a string so i have written condition like</p>
  
  <pre><code>if (str.length() &gt;= 4
              &amp;&amp; ((str.startsWith(str.substring(0, 2))).equals(str.endsWith(str
                      .substring(str.length() - 3, str.length() - 1)))))
  </code></pre>
  
  <p>but I am getting error as
  <strong>Cannot invoke equals(boolean) on the primitive type boolean</strong></p>
  
  <p>so what is the root cause?</p>