Write a method called wordCount that accepts a String as its parameter and returns the number of

Question:

Write a method called wordCount that accepts a String as its parameter and returns the number of words in the String . A word is a sequence of one or more nonspace characters (any character other than ' '). For example, the call wordCount( "hello ") should return 1, the call wordCount( "how are you? ") should return 3, the call wordCount(" this string has wide spaces ") should return 5, and the call wordCount(" ") should return 0.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: