public class Date {
private int day;
private int month;
private int year;
public Date(int theDay, int theMonth, int theYear) {
}
public void setDay(int theDay) {
day = theDay;
}
public int getDay() {
return day;
}
public void setMonth(int theMonth) {
month = theMonth;
}
public int getMonth() {
return month;
}
public void setYear(int theYear) {
year = theYear;
}
public int getYear() {
return year;
}
public void displayDate() {
System.out.printf("The current date is: %d/%d/%d", getDay(), getMonth(), getYear() );
}
}
+
public class DateTest {
public static void main( String[] args ) {
Date myDate = new Date(20, 5, 2010);
myDate.displayDate();
}
}
Результат : Текущая дата: 0/0/0 Ожидаемый результат: 20/5/2010
Я проверилмного раз, и я не вижу никакой ошибки.Убедился, что изменения были записаны и перезапущен Eclipse.Как вы думаете ?Это мой первый пост здесь, к сожалению, извините, если это неправильная форма публикации здесь.Спасибо!