[英]How can a method accept java.sql.timestamp when the definition of the method says that it accepts java.sql.date as a parameter?
I am working on a project where we have an existing util class for dates. 我正在做一个项目,其中有一个现有的util类用于日期。 There is an method there which accepts java.sql.Date
as a parameter but when while developing I pass a java.sql.Timestamp
object, it is working fine. 那里有一个方法可以接受java.sql.Date
作为参数,但是在开发时我传递了java.sql.Timestamp
对象,它工作正常。 One thing can be that the Timestamp is the child class of Date. 一件事可能是时间戳记是Date的子类。 I need some clarity on this 我需要澄清一下
yep, heredity 是的,遗传
java.lang.Object
|
+----java.util.Date
|
+----java.sql.Timestamp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.