Java – Count the number of words in a Sentence

Hello people, this is a simple Java program to find out the number of words in a sentence. Very useful for high school / college students who are willing to learn Java Programming.

Here is the script:

Read the comments in the above program to understand what’s happening!!.

And the output of the program will be:

Enter a sentence:
spider man
Number of words: 2

Enjoy the day!


Related Posts

Leave a Reply