title: AND vs OR operator for finding out if value is within range
body: <p>I was using Java to write a simple program with range conditioning, and found the below code seem to be inclusive of the floor &amp; ceiling.</p>
  <p>i.e. {do something} will be executed even if value equals 1,000 or 1,000,000.</p>
  <pre><code>if (value &lt; 1000 || value &gt; 1_000_000)
      do something;
  </code></pre>
  <p>I know that best practice for finding if value is within/out of range would be to use an &amp;&amp; operator instead of ||</p>
  <pre><code>if (value &gt;= 1000 &amp;&amp; value &lt;= 1_000_000)
      do something;
  </code></pre>
  <p>But I Just wonder why there would be a difference?</p>