A Palindrome is a text, number or sentence which can be read the same phrase or value backwards and forwards.

For instance: Anna(forward)    annA (backwards) 

We implement our code ignoring the lower and uppercase words because our word has the same meaning.

This may be prevented by adding to  palindrom.toLowerCase() to our  String.

String palindrom = "Anna";
		palindrom = palindrom.toLowerCase();
		String reverse = new StringBuilder(palindrom).reverse().toString();
		if(palindrom.equals(reverse)) {
			System.out.println("this is a palindrome");
			System.out.println("this is not a palindrome");

Source Code:

2 thoughts on “Palindrome”

Leave a Reply

Your email address will not be published. Required fields are marked *