Java program to check whether a string is a palindrome or not