
In this post, I will show you How to count number of Words in the String. It's easy via array and string class.
For example : "Hello World"
Result : 2.
Coding:
public class StringDemo
{
static int i,c=0,res;
static int wordcount(String s)
{
char...