源码如下:
package employee; import java.util.Date; public class EmployeeTest { public static void main(String[] args) { Date birth = new Date(12,16,1990); Date hire = new Date(1,23,2011); Employee employee = new Employee("Jimmy","Song",birth,hire); System.out.println(employee); } }
问题如下:
Eclipse给出Date birth 和 Date hire警告:
@SuppressWarnings("deprecation")
@SuppressWarnings("deprecation")
运行结果如下:
Song,Jimmy Birthday: Fri Oct 11 00:00:00 CST 1918 Hire: Tue Jun 02 00:00:00 CST 1908
时间于代码中的时间不符