a java program to count the number of words in a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

a java program to count the number of words in a string?

7th Jan 2018, 6:22 PM
Sreerag Murali
Sreerag Murali - avatar
2 Answers
+ 3
@jeremy sorry 😂
7th Jan 2018, 8:44 PM
Rishabh
Rishabh - avatar
+ 1
String[] words = sentence.split(" "); int wordCount = words.length;
7th Jan 2018, 6:25 PM
Jeremy
Jeremy - avatar