*
The moose likes Java in General and the fly likes Date instance printing the date without calling toString() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Date instance printing the date without calling toString() method" Watch "Date instance printing the date without calling toString() method" New topic
Author

Date instance printing the date without calling toString() method

upanshu vaid
Ranch Hand

Joined: Sep 07, 2012
Posts: 73

Hi ,
In this below code when I am passing the date object to S.O.P I am getting the output as current date and time , I wondered why this output is coming because this should print the hashcode of the object because I didn't override the toString method of object class.


Kindly clear my doubt on this.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30548
    
152

Some classes implement toString() directly. You can see in the JavaDoc that Date is one of them.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date instance printing the date without calling toString() method