title: Ternary if operator inside a regular if one
body: <p>In Java, if I use a ternary if operator inside a regular if, for example:</p>
  
  <pre><code>if ((x &gt; y - z) ? true : callLongWaitedMethod(many, parameteres)) {
          loveTeddyBear();
  }
  </code></pre>
  
  <p>will it execute the callLongWaitedMethod if <code>x &gt; y - z</code> is indeed true? I hope it is not and I can use this nice statement, slightly complicated at the first glance, but more attractive to compare with the extra boolean variable:</p>
  
  <pre><code>boolean b = (x &gt; y - z) ? true : callLongWaitedMethod(many, parameteres);
  if (b) {
          loveTeddyBear();
  }
  </code></pre>
  
  <p>especially if I'm using this inside a big loop which iterates over and over, so creating boolean each time will not be nice from the performance point of view while if I declare the boolean outside the loop, I may miss the neat because of the big size of the loop.</p>