The following function determine if its parameter is a string which reads exactly the same forward or backward. There is an error in the code.
boolean isPalindrome(String s) {
int i=0, j = s.length( ) -1;
while ( i !=j && s.charAt(i)==s.charAt(j)) {
i++;
j--;
}
return (i==j);
}
help please