tag:blogger.com,1999:blog-8712770457197348465.post8338793885001889729..comments2024-03-28T02:47:19.159-07:00Comments on Javarevisited: What is difference between java.sql.Time, java.sql.Timestamp and java.sql.Date - JDBC interview Questionjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8712770457197348465.post-59412560360107987302016-08-15T06:12:25.630-07:002016-08-15T06:12:25.630-07:00Hello @Peddi, you are absolutely correct, all thre...Hello @Peddi, you are absolutely correct, all three date and time classes from java.sql package e.g. Time, Timestamp, and Date extends java.util.Date but more importantly they violate Liskov substitution principle, hence cannot be used in place of each other. For example, you cannot pass java.sql.Timestamp to a method expecting java.util.Date even though Timestamp contains both date and time partjavin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-62180068689850670212013-05-28T11:47:39.395-07:002013-05-28T11:47:39.395-07:002) java.sql.Time and java.sql.Timestamp extends ja...2) java.sql.Time and java.sql.Timestamp extends java.util.Date class but java.sql.Date is independent.<br /><br />This point is INCORRECT.<br />All three types java.sql.Time, java.sql.Timestamp , and java.sql.Date are extended from from java.util.Date (http://docs.oracle.com/javase/7/docs/api/java/util/Date.html)<br />Peddihttps://www.blogger.com/profile/04653183481756633261noreply@blogger.com