title: Java boolean method with if statement - " must return a result of type boolean"
body: <p>I'm having troubles with boolean methods.</p>
  
  <pre><code>private boolean askYesNoQuestion(String prompt){
  prompt = prompt.toLowerCase();
  if(prompt.equals("yes")) return true;
  if(prompt.equals("no")) return false;
  else prompt = readLine("Please answer yes or no.");
  }
  </code></pre>
  
  <p>Eclipse says : "<strong>the method must return a result of type boolean</strong>".</p>
  
  <p>Same problem in the following code:</p>
  
  <pre><code>private boolean isPerfectSquare(int n){
  for(int i = 0; i &lt;= n; i++){
  if(i*i == n) {
  return true;
  }
  else return false;
  }
  </code></pre>
  
  <p>I think I already included <code>return</code> in the statements, except that they are after an <code>if</code> statement.    </p>