When I type in the following code into Eclipse:
Scanner keyboard = new Scanner (System.in);
System.out.print("Please input a word ");
String name = keyboard.nextLine();
if(input.startsWithIgnoreCase("pre"))
{
return input;
}
else
{
return "blah";
}
It red-underlines the input.startsWithIgnoreCase("pre") part and returns the following error: "The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files".
I'm not sure why it returns this error or what it even means. What I want to do is check that the inputted word starts with "pre" while ignoring case.
Try this code: