CODE:
public class Studente extends Persona{ String classe;
double mediaVoti;
double[] voti;
public Studente(int e, String n, char s, String em, String t, double mv, String cl){
super(e, n, s, em, t);
voti=new double[100];
mediaVoti=mv;
classe=cl;
}
public double[] getVoti(){
return voti;
}
public double getMediaVoti(){
return mediaVoti;
}
public String getClasse(){
return classe;
}
public void setMediaVoti(double mv){
mediaVoti=mv;
}
public void setClasse(String cl){
classe=cl;
}
public void setVoid(double[] cl){
voti=cl;
}
}
2 commenti:
La get di un array deve restituire un array, pertanto si può fare in questo modo: public double[] getVoti(){ return voti;}
Osserva che nel tipo di dati restituiti si mette double[] ossia un array. Prova.
Si ho provato e funziona
Posta un commento