This is a function to count the words that start with a vowel and end with this same vowel, but I only get an error.
this is the function
public int vocal2 (Frase f) {
StringTokenizer tk = new StringTokenizer (f.getOracion());
int i=0;
while (tk.hasMoreTokens()) {
char inicial = tk.nextToken().charAt(0);
int fil = (tk.nextToken().length()-1);
char cfinal = tk.nextToken().charAt(fil);
if (inicial == 'a' || inicial == 'e' || inicial == 'i' || inicial == 'o' || inicial == 'u') {
if (inicial == cfinal) {
i++;
}
}
}
return i;
}