Answers for "find a palindrome in a string using stringbuffer in java"

1

String palindrome in java using stringbuffer

// String palindrome in java using stringbuffer
public class PalindromeUsingStringBuffer
{
   public static void main(String[] args)
   {
      String strInput = "nayan";
      StringBuffer sb = new StringBuffer(strInput);
      sb.reverse();
      String str = sb.toString();
      if(strInput.equals(str))
      {
         System.out.println(str + " string is palindrome.");
      }
      else
      {
         System.out.println(str + " string is not palindrome.");
      }
   }
}
Posted by: Guest on February-22-2021

Code answers related to "find a palindrome in a string using stringbuffer in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language