I am sorry if there is an answer out there because I can't really find it. I have a method here where when I pass in a phrase and a letter, it will check if there is that letter in the phrase. Originally it will print out false or true if there is that letter you chose in the phrase. My assignment wants me to change it so that it will only print out how many times that letter appears in the phrase. I couldn't really figure it out, and keep getting an error because my return statement is an int not a boolean.
public boolean findLetter(String letter, String text)
{
boolean flag = false;
int count = 0;
for(int i=0; i < text.length(); i++)
{
if (text.substring(i, i+1).equalsIgnoreCase(letter) )
{
count++;
}
}
return count;
}