Can you write a method in Java that accepts a String argument and returns a number of words in it? A word is a sequence of one or more non-space characters i.e. any character other than '' (empty String). This should be your method signature:
public int count(String word);
This method should return 1 if the input is "Java" and return 3 if the input is "Java, C++, Python". Similarly a call to wordCount(" ") should return 0.
public int count(String word);
This method should return 1 if the input is "Java" and return 3 if the input is "Java, C++, Python". Similarly a call to wordCount(" ") should return 0.