Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. public class CountTest {
  2. public static void main(String[] args){
  3. countLike ({"a", "a", "b", "c"}, "a");
  4. }
  5.  
  6. public int countLike(String[] wordList, String word)
  7. {
  8. int count = 0;
  9. for (int i = 0; i < word.length; i++) {
  10. if (wordList[i].equals(word))
  11. count++; }
  12.  
  13. System.out.println(count);
  14.  
  15. return count;
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement