Count vowels and consonants in a given string
Write a Java program to count the number of vowels and consonants in a given string. The provided Java program counts the number of vowels and consonants in a given string. class Main { public static void main(String[] args) { String str = "Hello"; countVowelAndConsonant(str);…