Allora innanzitutto ti ringrazio per la celere risposta...
Vorrei analizzare un problema per volta se per te va bene xD
Ho riscritto la classe Elenco seguendo le esercitazioni che avevo scritto con un amico a casa.. Però, e non ridere, non so xkè i getter e i setter li scrivevamo così!
In questo modo, tutto funziona!codice:public class ElencoStudenti extends ArrayList { public void addStudente(String matricola, String cognome, String nome, Object appello, Object voto) { Studente st = new Studente(matricola, cognome, nome, appello, voto); this.add(st); } public String getMatricola(int i){ Studente temp; temp = (Studente) this.get(i); return temp.getMatricola(); } public String getCognome(int i){ Studente temp; temp = (Studente) this.get(i); return temp.getCognome(); } public String getNome(int i){ Studente temp; temp = (Studente) this.get(i); return temp.getNome(); } public Object getAppello(int i){ Studente temp; temp = (Studente) this.get(i); return temp.getAppello(); } public Object getVoto(int i){ Studente temp; temp = (Studente) this.get(i); return temp.getVoto(); } public void setMatricola(int i, String matricola){ Studente temp; temp = (Studente) this.get(i); temp.setMatricola(matricola); } public void setCognome(int i, String cognome){ Studente temp; temp = (Studente) this.get(i); temp.setCognome(cognome); } public void setNome(int i, String nome){ Studente temp; temp = (Studente) this.get(i); temp.setNome(nome); } public void setAppello(int i, Object appello){ Studente temp; temp = (Studente) this.get(i); temp.setAppello(appello); } public void setVoto(int i, Object voto){ Studente temp; temp = (Studente) this.get(i); temp.setVoto(voto); } }
Altro problema è che anche lui deve presentare questo progetto quindi non volevo utilizzare questo metodo sapendo che lo usa anche lui!


Rispondi quotando