new Date() in println() is equal to new Date().toString(). new Date() returns the current date and time.

解决方案 »

  1.   

    对楼上的补充:
    用new Date()创建了无引用对象,而System.out.println(data)里的data如果是对象,则调用toString()方法。
    在Date类里面toString()方法的说明:
    public String toString()Converts this Date object to a String of the form: 
          dow mon dd hh:mm:ss zzz yyyywhere:
    1、dow is the day of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat). 
    2、mon is the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). 
    3、dd is the day of the month (01 through 31), as two decimal digits. 
    4、hh is the hour of the day (00 through 23), as two decimal digits. 
    5、mm is the minute within the hour (00 through 59), as two decimal digits. 
    6、ss is the second within the minute (00 through 61, as two decimal digits. 
    7、zzz is the time zone (and may reflect daylight savings time). Standard time 8、zone abbreviations include those recognized by the method parse. If time zone   information is not available, then zzz is empty - that is, it consists of no characters at all. 
    9、yyyy is the year, as four decimal digits. 
      

  2.   

    等价于:Date tt = new Date();
    System.out.println(tt);