import java.util.Scanner; public class PalindromeTester { public static void main (String[] args){ int firstPosition = 0; int lastPosition; boolean isAPalindrome = true; Scanner in = new Scanner(System.in); System.out.println("Enter a word:"); String word = in.next(); System.out.println(word.length()); lastPosition = word.length() - 1; while(firstPosition < lastPosition) { if(word.charAt(firstPosition)!=word.charAt(lastPosition)) isAPalindrome = false; firstPosition++; lastPosition--; } // end of while loop if(isAPalindrome) System.out.println("The word is a Palindrome"); else System.out.println ("The word is not a Palindrome "); } // end of main method }// end of class