Java Program to count Vowels and Consonants in a given string

Program

import java.util.Scanner;
public class CountVowelsAndConsonantsInString {
    public void countVowelConsonants(String inputStr)
    {
        int vowelCount = 0;
        int consonantCount = 0;
        inputStr = inputStr.toLowerCase();
        for(int i = 0; i < inputStr.length(); i++) {    
            //check for vowel  (a, e, i, o, u) 
            if(inputStr.charAt(i) == 'a' || inputStr.charAt(i) == 'e' || inputStr.charAt(i) == 'i' || inputStr.charAt(i) == 'o' || inputStr.charAt(i) == 'u') {    
               // Increment vowel count  
               vowelCount++;    
            }    
            //Checks for consonant    
            else if(inputStr.charAt(i) >= 'a' && inputStr.charAt(i)<='z') {      
                //Increment consonant count   
                consonantCount++;    
            }              
        }
        System.out.println("Number of vowels: "+ vowelCount); 
        System.out.println("Number of consonants: "+ consonantCount);
    }
    public static void main(String[] args)
    {
        CountVowelsAndConsonantsInString countVowelsAndConsonantsInString = new CountVowelsAndConsonantsInString();
        Scanner reader = new Scanner(System.in);
        System.out.print("Enter the String: ");
        String inputString = reader.nextLine();
        countVowelsAndConsonantsInString.countVowelConsonants(inputString);
    }
}

Output

$ javac CountVowelsAndConsonantsInString.java
$ java CountVowelsAndConsonantsInString
Enter the String: oodlescoop
Number of vowels: 5
Number of consonants: 5