請問有人能指出我程序中的錯誤嗎?Java-Check迴文檢測
輸出始終是:「它不是一個迴文」
String newstr="";
for(int j=length-1;j>0;j--)
{
char m=str.charAt(j);
newstr=newstr+m;
}
if(newstr.equals(str))
System.out.println("it is a palindrome");
else
System.out.println("it is not a palindrome");
在此先感謝:)
請不要修改你的問題默默納入答案給定的所有修復這使得它不可能看到什麼居然問也。 - - 你起來日期代碼應該可以工作,所以沒有更多的問題需要回答。 – creinig
@creinig更新後的代碼失敗,請參閱[Shah's answer](http://stackoverflow.com/a/16690648/2040040) – johnchen902
對不起,不,它仍然不起作用。 – aqua