How does short-circuiting of && and || work in java?
<p>Suppose we use <strong>and</strong> operator such that </p>

<pre><code>if (a.enable() &amp;&amp; b.enable())
</code></pre>

<p>so the above statements indicates that both the statements need to be true to proceed</p>

<p>What about the case if <code>a.enable()</code> return false, and if we write the statement such that</p>

<pre><code>if (a.enable() &amp;&amp; (b.enable() || c.enable()))
</code></pre>

<p>so this above statement means that <code>a.enable()</code> needs to be true and from the second part either <code>b.enable()</code> or <code>c.enable()</code> needs to be true. Either one of them needs to be true to proceed, but if <code>a.enable()</code> is not true then the condition fails without any further checks.</p>

<p>Is this correct?</p>
