Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date instance printing the date without calling toString() method  RSS feed

 
upanshu vaid
Ranch Hand
Posts: 83
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Sheriff
Posts: 36417
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some classes implement toString() directly. You can see in the JavaDoc that Date is one of them.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!