Professional Documents
Culture Documents
int count = 0;
for (char c : ch)
{
switch(c){
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
count++;
break;
}
}
System.out.println("No of Vowel count is " + count);
sc.close();
}
}
way 2
import java.util.Scanner;
import java.util.regex.*;
int count = 0;
while (matcher.find()) {
count++;
}
way 3
import java.util.Scanner;
public class Voweldemo {
public static void main(String args[]) {
System.out.println("Enter String");
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().toLowerCase();
sc.close();
2) Write a java program to find number of words in a sentence and the corresponding
chracters?