enters the while loop, if I enter the correct value which in this case is 3, leaves the loop, but if not, I enter the if, and I do not leave there even if I enter the 3 again, how do I get out of the if and return to the beginning of the while?
String velas = "3";
String total ="";
while (total.equals(velas)== false){//aqui empieza el bucle
System.out.println("introduce tu respuesta");
total = S.nextLine();
if(total.equals(velas)==false){//este if es por si el usuario se equivoca
System.out.println("respuesta incorreta, ¿quieres una pista? \n pista 1 \n pista 2 \n pista 3 ");
int opcion = S.nextInt();
switch(opcion){
case 1:
System.out.println("Tienen que quedar cierta cantidad de velas al final");
break;
case 2:
System.out.println("segunda pista");
break;
case 3:
System.out.println("tercera pista");
break;
default:
System.out.print("no existe esa opción");
}
}
}