| Author |
regarding DateFormat and calender
|
Santhi Bharath
Ranch Hand
Joined: Jun 03, 2008
Posts: 75
|
|
hi, while i am printing the objects of DateFormat and Calendar objects,i got something surprising like this java.text.SimpleDateFormat@ce9bf0a5 -- for DateFormat java.util.GregorianCalendar[all fields of Calender .....] -- for Calender why we are getting sub class names instead of Calender and DateFormat?
|
thanks and regards<br />Santhi Bharath<br />SCJP 5.0, SCWCD 5.0
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12928
|
|
That's because class SimpleDateFormat does not override the toString() method from class Object, and class GregorianCalendar does. If you print an object with System.out.println(...), then toString() will be called on the object to get a printable string.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: regarding DateFormat and calender
|
|
|