这是我编写的代码,显示错误,如图帮助我。
class palindrome
{
public static void main(String args[])
{
StringBuffer sb = new StringBuffer("nitin");
System.out.println(sb);
String sb1=sb.reverse();//error coming in this line why ?
if(sb1.contentEquals(sb))
{
System.out.println("palindrome");
}
else
{
System.out.println("not a palindrome");
}
}
}