13.6k views
4 votes
Write a method named isVowel that returns whether a String is a vowel (a single-letter string containing a, e, i, o, or u, case-insensitively).public static boolean isVowel(String word){ for(int i=0;i

User Roay Spol
by
4.9k points

1 Answer

0 votes

Answer:

public static boolean isVowel(String word){

for(int i=0;i

char vowels= word.toLowerCase(word.charAt(i));

if (vowels== "a" || vowels == "e" || vowels== "i" || vowels == "o" || vowels == "u" ){

return true;

} else {

return false;

}

}

}

Step-by-step explanation:

The Java source code analyzes each character in a string object and returns true if it is a vowel letter.

User Merijn
by
4.8k points