缺少返回语句的错误。有人知道代码有什么问题吗?
import java.text.*;
public class Sentence {
private String text;
public Sentence(String str) {
str = text;
}
public boolean isPalindrome() {
int length = text.length();
for(int n = 0;n <= length/2;n++) {
char letterFromFront = text.charAt(n);
char letterFromBack = text.charAt(length);
if(letterFromFront == letterFromBack) {
return true;
}else {
return false;
}
}
}
}