employer cover photo
employer logo

Frage im Vorstellungsgespräch bei CSC

How to get Vowels count from String. Java Exceptions. Selenium locators. Alerts.

Antwort im Vorstellungsgespräch

Anonym

12. Nov. 2017

Please use the below function to find the count of vowels in a string passed as the method argument: public static void getVowelsCounts(String str) { int count = 0; int n = str.length(); for (int i = 0; i < n; i++) { switch (str.charAt(i)) { case 'a': case 'e': case 'i': case 'o': case 'u': count++; break; default: } } System.out.println("Total number of vowels are " + count); } }