Answers for "how to check if a string can be a palindrome or not java"

6

Java program to check whether string is palindrome using library methods

public class StringPalindromeJava
{
   public static void isPalindrome(String str)
   {
      String strReverse = new StringBuffer(str).reverse().toString();
       // checking for palindrome
      if(str.equals(strReverse))
      {
         System.out.println(str + " is palindrome string.");
      }
      else
      {
         System.out.println(str + " is not palindrome string.");
      }
   }
   public static void main(String[] args)
   {
      // palindrome java
      isPalindrome("eye");
      isPalindrome("rotator");
   }
}
Posted by: Guest on November-02-2020

Code answers related to "how to check if a string can be a palindrome or not java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language