public static void ejemplosString(String palabra){
char[] letras = palabra.toCharArray();
int contadorVocales = 0;
for (int i = 0; i < letras.length; i++) {
if (char[i] == 'a') {
contadorVocales++;
}
if (char[i] == "e") {
contadorVocales++;
}
if (char[i] == "i") {
contadorVocales++;
}
if (char[i] == "o") {
contadorVocales++;
}
if (char[i] == "u") {
contadorVocales++;
}
}
}
Getting the error on every If statement. Any guidance?
Even when changing the vowels to single quotes, I still get this error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - unexpected type
required: value
found: class
at practico1.Main.ejemplosString(Main.java:64)
at practico1.Main.main(Main.java:34)
Java Result: 1