When I test this code:
java.util.Date date = new java.util.Date();
java.util.Date stamp = new java.sql.Timestamp(date.getTime());
assertTrue(date.equals(sta
Nican explained the equals part, about compareTo:
Timestamp has a compareTo(Date) method that converts it to Timestamp internally Date does the comparison by downcasting (since Timestamp is a subclass of it); but as the javadoc states: "The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance"Which of course is an horrible idea, in my opinion.