title: Java boolean method return
body: <p>I have a boolean method in my Java program and I'm wondering why NetBeans is recommending making this change to my code:</p>
  
  <pre><code>return isPrime != 0;
  </code></pre>
  
  <p>What I wrote was:</p>
  
  <pre><code>if (isPrime == 0) {
              return false;
  
          }
          else{
              return true;
          }
  </code></pre>
  
  <p>Both work correctly but I cannot understand the logic behind the change NetBeans is suggesting. Neither true or false is being returned. Could someone explain to me the logic behind this? Thanks</p>