1// String palindrome in java using stringbuffer
2public class PalindromeUsingStringBuffer
3{
4 public static void main(String[] args)
5 {
6 String strInput = "nayan";
7 StringBuffer sb = new StringBuffer(strInput);
8 sb.reverse();
9 String str = sb.toString();
10 if(strInput.equals(str))
11 {
12 System.out.println(str + " string is palindrome.");
13 }
14 else
15 {
16 System.out.println(str + " string is not palindrome.");
17 }
18 }
19}