GregorianCalendar class getActualMaximum(int field) method example
Returns the maximum value that this calendar field could have
GregorianCalendarclass getActualMaximum(int field) method example. This example shows you how to use getActualMaximum(int field) method.This method Returns the maximum value that this calendar field could have, taking into consideration the given time value
Here is the code:-
/**
* @Program that Returns the maximum value that this calendar field could have
* GetActualMaximum.java
* Author:-RoseIndia Team
* Date:-27-May-2008
*/
import java.util.*;
public class GetActualMaximum {
public static void main(String[] args) {
//Creating a Calendar
GregorianCalendar g=new GregorianCalendar(2004,6,23);
//Returns the maximum value that this calendar field could have
int i=g.getActualMaximum(Calendar.YEAR);
System.out.println("The maximum value that this calendar field could have is: "
+i);
}
} |
Output of the program:-
| The maximum value that this calendar field could have is: 292278994 |
|