A question regarding a job I'm doing in java. It turns out that I have the next part of a superclass:
public abstract class Jugador {
private String nombre;
private int cantVidas;
private int nivelActual;
public Jugador(String nombre) {
this.nombre = nombre;
cantVidas=3;
nivelActual=0;
}
There are also its getters and setters corresponding to each variable. I have a subclass called "Beginner", my question is: Can I do the following method in this subclass?
public void pasarDeNivel(){
int nivel;
nivel = getNivelActual();
nivel = nivel + 1;
}
and then make a method that prints the level. and that it fits you that the level is now 1.
I have the problem that I will always have the variable "level" in 0, it never increases to 1.