title: How do I ask the user when he/she wants to quit the program
body: <p>Here's the program that I'm working on but I'm having problems with figuring out how to ask the user if they are done with it by saying a word or number.</p>
  
  <pre><code>import java.util.Scanner;
  
  class paliindrome {
      public static void main(String args[]) {
  
          String isPalindrome, reverse = "";
          Scanner in = new Scanner(System.in);
          Scanner keyboard = new Scanner(System.in);
          PalindromeChecker aGame = new PalindromeChecker();
  
          System.out.println(" Please type a word and I'll figure out if it's a palindrome(The program is case sensitive).");
          isPalindrome = in.nextLine();
  
  
          int length = isPalindrome.length();
  
          for ( int i = length - 1; i &gt;= 0; i-- )
              reverse = reverse + isPalindrome.charAt(i);
  
          if (isPalindrome.equals(reverse))
              System.out.println("The word that you have entered is a palindrome.");
          else
              System.out.println("The word that you have typed isn't a palindrome.");
  
          char answer;
          do {
              aGame.play ();
  
              System.out.print("\n Do you want to continue (y or n)?");
              answer = keyboard.next().charAt(0);
          } while (answer == 'y' || answer == 'Y');
      }
  }
  </code></pre>