Java Solution with Easy & Beginner-friendly code
Code

# Code
```java []
class Solution {
    public int prefixCount(String[] words, String pref) {
        int ans = 0;
        int lengthOfPref = pref.length();
        for(int i =0; i<words.length; i++){
            if((words[i].contains(pref)) && (words[i].substring(0, lengthOfPref).equals(pref))){
                ans +=1;
            }
        }

        return ans;
    }
}
```
['Java']