Answer:
import java.util.ArrayList;
public class U7_L4_Activity_One
{
public static int countSecondInitial(ArrayList<String> list, String letter)
{
char letter1 = letter.toLowerCase().charAt(0);
int count = 0;
String phrase = "";
for(int i = 0; i < list.size(); i++)
{
phrase = list.get(i).toLowerCase();
if(phrase.charAt(1) == letter1)
{
count++;
}
}
return count;
}
}
Step-by-step explanation:
I genuinely couldn't tell you why the program cares, but it worked just fine when I ran the search word as a char variable as opposed to a 1-length string variable, i.e. the inputted 'letter' parameter.
If it works, it works.
PS. You got 33% RIGHT because you didn't have a 'public static void main' as the method header. I don't doubt your code works fine, but the grader is strict about meeting its criteria, so even if your code completed it perfectly and THEN some, you'd still get the remaining 66% wrong for not using a char variable.