Calendar class after(Object when)method example
Calendar class after(Object when)method example. This example shows you how to use after(Object when) method.This method Returns whether this Calendar represents a time after the time represented by the specified Object.
Here is the code:-
/**
* @Program that Returns whether this Calendar represents a time after the time
* represented by the specified Object.
* aftercalender.java
* Author:-RoseIndia Team
* Date:-21-May-2008
*/
import java.util.*;
public class aftercalender {
public static void main(String[] args) {
//creating calender
Calendar cal = new GregorianCalendar();
Calendar cal1 = new GregorianCalendar(2009,05,14);
//Returns whether this Calendar represents a time after the time represented
//by the specified Object.
boolean b= cal1.after(cal);
System.out.println("cal1 is after cal or not: "+b);
}
} |
Output of the program:-
| cal1 is after cal or not: true |
|