Java.util.Date.after() 方法


Java.util.Date.after() 方法

package com.codingdict;

import java.util.*;

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

      // create 2 dates
      Date date = new Date(2011, 5, 21);
      Date date2 = new Date(2015, 1, 21);

      // tests if date 2 is after date and print
      boolean after = date2.after(date);
      System.out.println("Date 2 is after date: " + after);

      // tests if date is after date 2 and print
      after = date.after(date2);
      System.out.println("Date is after date 2: " + after);
   }
}