Can someone help me figue out why I keep getting an erorr that I am missing a return statement.
import java.util.*;
public class ec1
{
static Scanner kb = new Scanner(System.in);
public static void main(String[] args)
{
String word = " ";
String s = " ";
char letter;
int i=0, j=0;
boolean isPal;
System.out.println("Enter a string of text to check if a palindrome: (end to file");
while (kb.hasNext() )
{
s =kb.nextLine();
for (i=0; i < s.length(); i++) {
letter = s.charAt(i);
if(Character.isLetter(letter))
{
word += letter;
}
}
if(isPal(word))
System.out.println(word + " is not a Palindrome");
else
System.out.println(word + " is a Palindrome");
word = "";
System.out.println("Enter a string to check if a palindrome: (end to file");
}
}
public static boolean isPal(String s)
{
int len = s.length();
int i, j;
char ch1, ch;
j = len - 1;
for (i = 0; i <= (len -1)/2; i++)
{
ch = s.charAt(i);
ch1 = s.charAt(j);
if(!Character.isLetter(ch) && ! Character.isLetter(ch1) && ch != ch1)
//j--;
{
return true;
}
else
{
return false;
}
}
}
}