X1282: Count Times

Complete the method countTimesContains that returns the number of times the array words contains the word stored in searchW. Remember to use .equals() to compare words.

Examples:

countTimesContains({"a", "b", "b", "d"},"a") -> 1
countTimesContains({"a", "b", "b", "d"},"b") -> 2
countTimesContains({"a", "b", "b", "d"},"c") -> 0

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.