【发布时间】:2015-12-21 12:36:43
【问题描述】:
// set date of birth
public void setDOB(int day, int month, int year)
{
this.day = day;
this.month = month;
this.year = year;
}
// get date of birth
public int getDOB()
{
return day;
return month;
return year;
}
为什么当我尝试返回这三个值时会出错?我认为我可以通过不为日、月和年编写每个 set/get 方法来节省一些空间。
另外,我似乎只收到了return month; 的错误,这意味着它是 eclipse 突出显示的唯一一个告诉我删除它。
【问题讨论】: