Answers for "program to check whether a string can be formed as palindrome 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
0

integer palindrome in java

public boolean isPalindrome(int x) {
        String str = Integer.toString(x);
        String reverse =  new StringBuilder(str).reverse().toString();
        return  str.equals(reverse)?true:false;}
Posted by: Guest on April-26-2021

Code answers related to "program to check whether a string can be formed as palindrome java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language