title: Error: missing return value in Java
body: <p>So I've built a method to find prime numbers.  It seems to work only when i forcible mark it as true.  However when I leave it as I would like it, the compiler disagrees.</p>
  
  <p>How do I satisfy the missing return value error?</p>
  
  <pre><code>private static boolean isPrime( int n)
      // write a loop that sets a loop variable named divisor that goes from 2 to n/2
      // in the loop call isFactor to see if divisor divides n evenly
      // if it does print out that divisor followed by a space (no newline)
      {
          for (int divisor = 2; divisor &lt;= n; divisor++)
          {
              boolean prime = true;   
              for (int i = 2; i &lt; divisor; i++)
              {
                  if (isFactor(n, divisor))
                  {
                      return false;
                  }
  
              }
  
          }
          return true; // i just put this here so it would compile at all
      }
  </code></pre>