home
search
help
profile
liking the experience? our app is even better
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now  
showing results for string palindrome using stringbuffer in java
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}
upvote
downvote
source