Sto cercando di creare una classe...perche mi restituisce l'errore al return del costruttore??
Cannot return a void result
public class class_calendario
{
public Calendar Calendario(String submit,String month_now,String year_now) {
Calendar cal = new GregorianCalendar();
int num_month_now = Integer.parseInt(month_now);
int num_year_now = Integer.parseInt(year_now);
int new_month_now;
int new_year_now;
if (submit.equals("Prev")){
new_month_now = num_month_now - 1;
if (new_month_now < 0){
new_month_now = 11;
new_year_now = num_year_now - 1;
}
}
else if (submit.equals("Next")){
new_month_now = num_month_now + 1;
if (new_month_now == 12){
new_month_now = 0;
new_year_now = num_year_now +1;
}
}
return cal.set(new_year_now,new_month_now,1);
}
}

Rispondi quotando