I'm trying to create the next hierarchy. I have an abstract class called person in the following way.
public abstract class Persona {
protected String nombre;
protected String apellidos;
protected final String dni;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public String getDni() {
return dni;
}
of which I need to create a class called partner that inherits from this person class. the problem is that since you can not instantiate from an abstract class I need to do it from the partner class but I miss an error with the final DNI attribute. the code of the partner class is as follows.
package Biblioteca;
public class Socio extends Persona {
public Socio(String nombre, String apellidos, String dni) {
this.nombre = nombre;
this.apellidos = apellidos;
this.dni = dni;
}
}
the case that the DNI attribute has to be final and I can not do it.