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.
2 Answers