Java word count program

后端 未结 22 1414
北荒
北荒 2020-12-09 06:48

I am trying to make a program on word count which I have partially made and it is giving the correct result but the moment I enter space or more than one space in the string

22条回答
  •  轮回少年
    2020-12-09 07:14

    You can use this code.It may help you:

    public static void main (String[] args)
    {
    
       System.out.println("Simple Java Word Count Program");
    
       String str1 = "Today is Holdiay Day";
       int count=0;
       String[] wCount=str1.split(" ");
    
       for(int i=0;i

提交回复
热议问题