I am checking if a String "nitin" is a palindrome but it's returning false.
Please anyone help me to shorout this.
public static void main(String[] args) { StringBuffer sb = new StringBuffer("nitin"); sb.reverse(); String rev = sb.toString(); System.out.println(sb); System.out.println(rev); if (sb.equals(rev)) { System.out.println("true"); } else { System.out.println("false"); } }