Equivalent boolean statements have different results
<p>I am confused about how &amp;&amp; operator is working</p>

<pre><code>if (StringUtils.isNotEmpty(cartModification.getStatusCode()) 
    &amp;&amp; (cartModification.getStatusCode().equalsIgnoreCase(UNFCommerceCartModificationStatus.Sell_Out)))
</code></pre>

<p>Above statement is coming as true</p>

<p>while</p>

<pre><code>if (StringUtils.isNotEmpty(cartModification.getStatusCode()) 
    &amp;&amp; cartModification.getStatusCode().equalsIgnoreCase(UNFCommerceCartModificationStatus.Sell_Out))
</code></pre>

<p>is evluaated as false.Only difference between the 2 statements are braces.</p>

<p>As an additional input i have checked it with debugger and </p>

<pre><code> StringUtils.isNotEmpty(cartModification.getStatusCode() =true
cartModification.getStatusCode().equalsIgnoreCase(UNFCommerceCartModificationStatus.Sell_Out)=true
</code></pre>

<p>I just added extra parenthesis in the second part and it was evaluated as true, Data is same as i have pointed out in question.</p>
