Java Calendar equals方法


Java Calendar equals方法

package com.codingdict;

import java.util.*;

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

      // create two calendars
      Calendar cal = Calendar.getInstance();

      // specify a date for one of them
      Calendar cal2 = new GregorianCalendar(2011, 04, 29);

      // compare the two calendars.
      boolean b = cal.equals(cal2);

      // print result
      System.out.println("Calendars are equal :" + b);
   }
}