public static boolean AllVowels(String hello) {
int numLength = hello.length();
boolean tValue = true;
int i = 0;
while (i<=numLength) {
char temp = hello.charAt(i);
if (temp == 'a') {
tValue = true;
}
else if (temp== 'e') {
tValue = true;
}
else if (temp == 'i') {
tValue = true;
}
else if (temp == 'o') {
tValue = true;
}
else if (temp == 'u') {
tValue = true;
}
else {
tValue = false;
}
i+=1;
}
return tValue;
}
I wanted to create a method that, when called, will test the inputted string's contents and would return true or false depending on it contains all vowels. (true if all vowels. false if it contains a single consonant.) I am wondering how could I change this so that as soon as it encounters a consonant, it will immediately change the tValue to false and not test the other letters.
I would appreciate any guidance concerning my error.