why it throws exceptions in the main when I try to use this method? I doubt that there is something wrong with the return statements
public static boolean checkPalindrome(String inputString) {
String [] letters=inputString.split("");
int num=inputString.length();
int middle=num%2;
boolean plaindrome=false;
if(middle==0){
for(int i=0;i<num;i++){
if(letters[i].equals(letters[num-i])){// it tells there is something wrong on this line
plaindrome= true;
}else{
return false;
}
}
}else{
for(int i=0;i<num;i++){
if(letters[i].equals(letters[num-i])){
plaindrome= true;
}else{
return false;
}
}
}
return plaindrome;
}