Online Java Compiler By
JavaTpoint.com
import java.util.Date; public class JavaDateCompareToExample1 { public static void main(String[] args) { Date d=new Date(1997,3,10); Date d1=new Date(2018,9,21); int comparison=d.compareTo(d1); System.out.println("Your comparison value is : "+comparison); } }
Output