Il tuo metodo deve restituire un'oggetto String. Ma prova un po' ad immaginare cosa succede se gli passi un intero il cui valore è < 0 oppure > 4 ?Originariamente inviato da --LO--
public String get_info(int selection)
{
if (selection == 0)
return this.data;
if (selection == 1)
return this.ora;
if (selection == 2)
return this.luogo;
if (selection == 3)
return this.oggetto;
if (selection == 4)
return this.note;
}
Ecco perchè il compilatore ti segnale l'errore. Potresti aggiungere un ultima opzione in un blocco else oppure riscrivere il metodo.
Ciao.

Rispondi quotando