Java program to print whether the given string is a palindrome

Java Programming Java8Object Oriented Programming

A given string is called a palindrome if the reverse of the string is the string itself. For example, the strings “mom”, “bob”.

Algorithm

1. Get the number to check for palindrome
2. Hold the number in a temporary variable
3. Reverse the number
4. Compare the temporary number with the reversed number
5. If both numbers are same, print "palindrome number"
6. Else print "not palindrome number"

Program

But if we want to check if "Madam" is palindrome or not , it will show us that it is not a palindrome because of the upper case of first letter.

raja
Published on 25-Apr-2018 06:58:04
Advertisements