Answers for "java program that counts how many words that start with a"

3

count the number of words in a string java

public static void main(String[] args)
    { 
        //return the number of words in a string 
        
       String example = "This is a good exercise"; 
       
       int length = example.split(" ").length;
       
       System.out.println("The string is " + length + " words long.");
        
        
    }
Posted by: Guest on June-04-2020

Code answers related to "java program that counts how many words that start with a"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language