Write a Java Program to Check String is palindrome or not using String Buffer.In this program, it is very easy to check the given string is Palindrome or not.
In this program ,First convert the String to StringBuffer. I am reversing the string using reverse() method in String Buffer Class and then comparing the reversed string with original string using compareTo() method in string.
Steps: :
Procedure : :
Palindrome: :
Not Palindrome: :
The following code accepts a string, and checks whether the given string is Palindrome or not using String Buffer.The Program below is successfully compiled and run on the Windows System to produce desired output.
SOURCE CODE : :
OUTPUT : :
need an explanation for this answer? contact us directly to get an explanation for this answer