X625: Count non-null strings

Complete the function countStrings() so that it returns the count of Strings in the array names that are not null.

Examples:

countStrings({}) -> 0
countStrings({"pedro",null}) -> 1
countStrings({"pedro",null,"maria"}) -> 2
countStrings({"pedro","maria","don"}) -> 3

Your Answer:

x
 
1
public int countStrings(String[] names)
2
{
3
  
4
}
5

Feedback

Your feedback will appear here when you check your answer.