Krivalar Tutorials 
Krivalar Tutorials


Palindrome Word - Java Program

Palindrome word is a word which remains when spelt from right to left. Examples of palindrome are Racecar, Level, Malayalam, Noon, Deed, Madam.



public class PalindromeWord {
	public static void main (String args[]) {
		String word="racecar";
		int length=  word.length();
		String reverse = "";
		for(int i=1; i<=length; i++) {
			reverse = reverse + word.charAt(length-i);
		}
		System.out.println("reverse:" + reverse );

		if(word.equals(reverse)) {
			System.out.println("" + word + " is a palindrome");
		}
		else {
			System.out.println("" + word + " is not a palindrome");
		}
	}
}

The above code prints

reverse: racecar
racecar is a palindrome


























Searching using Binary Search Tree