public static int countLetter(String[] x, String y){
int count = 0;
for(int i = 0; i < x.length; i++){
for(int h = 0; h < x[i].length(); h++){
String yo = new String(x[i].substring(h,h+1));
if(yo==y){
count++;}
}
}
return count;
}
}
My method should return an integer that counts how many times total the letter appears in all strings of the array. (Assuming the string is one letter and I can't use charAt()).