Java.util.Date.equals() 方法


Java.util.Date.equals() 方法

package com.codingdict;

import java.util.*;

public class DateDemo {
   public static void main(String[] args) {

      // create 2 dates
      Date date = new Date(70, 1, 10);
      Date date2 = new Date(70, 1, 10);

      // Check if they are equal
      boolean check = date.equals(date2);

      // print the result
      System.out.println("Dates are equal:" + check);
   }
}