0

any one can figure out dis

Define a class: MyDate, including fields: year, month, day; member methods: setYear, getYear, isLeapYear (boolean, determine whether the current is a leap year), print(print year\month\day of the object). (1) In “main”method, through: “MyDate d1=new MyDate(); MyDate d2=new MyDate(2009,4,1);”construct a MyDate object d1(1999.1.1) and a MyDate object d2(2009.4.1), and print the information of d1 and d2, respectively. (2) Make the “year”of d1 have the same value as d2, make the “month”of d2 have the same value as d1, then print the information of d1 and d2.

24th Dec 2016, 8:40 AM
xo101
2 ответов