Error when making the equal of the boolean continue in the while.
boolean cannot be dereferenced
boolean seguir = false;
do{
/*Aquí hay un juego... y pregunta si quiere seguir jugando*/
seguir = Character.toUpperCase(volverjugar.charAt(0))=='S' ;
} while ( seguir.equals(true) );
You have an error on the following line:
You are trying to compare a
boolean
as aString
The correct way would be:
Whenever
seguir
,false
break the cycleTo compare booleans you must compare as follows:
or better yet:
I hope it has helped you.
Regardless of the fact that you don't need to use the method
equals()
to compare booleans, you are calling a method on a primitive type.As you have already been told, you only need to do this:
while (seguir)
. But if you want, for whatever reason, to make use of the method,equals()
you must declare the variable asBoolean
instead ofboolean
:Boolean seguir = false;