This is making me angry. I keep getting a "this method must return a result of type int" error message, but obviously I have a return statement. This is a program that is supposed to perform a sequential search for a string index.
public static int nameSearch(String[] inOrder, String searchedFor)
{
for (int i = 0; i < inOrder.length; i++)
{
if (searchedFor == inOrder[i])
{
return i;
}
else if (i > inOrder.length)
{
return -1;
}
}
}
Does anybody know what is wrong?