title: Java Boolean Input Error Checking
body: <p>So I'm trying to get the user to input their answer as a boolean and then error check that, but that doesn't seem to be working.  Am I on the right track or is there a better way to do this?  I had thought about doing it where the input is a string and just checking it against two other strings that I assign to "true" and "false," but my while loop:</p>
  
  <pre><code>while (!continueGame.equalsIgnoreCase(answerTrue) &amp;&amp; !continueGame.equalsIgnoreCase(answerFalse)) {    
          System.out.println("Would you like to try again? (true/false)");
          continueGame = keyboard.nextBoolean();
          System.out.println();
      }
  </code></pre>
  
  <p>Didn't work either.  I'm fairly certain it's something to do with my not's, but I'm not sure why.  Anyway, below is my method for error checking using booleans instead of strings.  The string version was basically the same way but just modified for strings.</p>
  
  <pre><code>public static boolean continueGame() {
      boolean continueGame;
  
      System.out.println("Would you like to try again? (true/false)\n");
      continueGame = keyboard.nextBoolean();
      System.out.println();
  
      while (continueGame != true &amp;&amp; continueGame != false) {    
          System.out.println("Would you like to try again? (true/false)");
          continueGame = keyboard.nextBoolean();
          System.out.println();
      }
      if (continueGame) {
          return true;
      }
      else {
          System.out.println("We accept your surrender.");
          return false;
      }
  
  } //End continueGame method
  </code></pre>