Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CountTest {
- public static void main(String[] args){
- countLike ({"a", "a", "b", "c"}, "a");
- }
- public int countLike(String[] wordList, String word)
- {
- int count = 0;
- for (int i = 0; i < word.length; i++) {
- if (wordList[i].equals(word))
- count++; }
- System.out.println(count);
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement