I'm doing a program with which you have to enter a sentence ending in point and you have to say for example the vowel "a" comes out in position 7 and so with all the vowels. The first part that is a finished sentence in point I have done well. But then the part where you have to find the vowels does not work well.
String texto;
int c;
System.out.println("Introduce un texto terminado en punto:");
texto="";
do{
texto=texto+ent.nextLine().trim();
if(!texto.endsWith(".")) texto+="\n";
}while(texto.charAt(texto.length()-1)!='.');
String cadena="aeiou";
for (int i = 0; i < texto.length(); i++){
int b = 0;
b++;
String a;
a=cadena.charAt(b);
System.out.format("\n%d caracter %c",i,text.charAt(a));
}
This is the error that shows me:
error: incompatible types: char can not be converted to String a = string.charAt (b); error: incompatible types: String can not be converted to int System.out.format ("\ n% d character % c ", i, text.charAt (a));
But if I put char in addition to String peta equally