Java GregorianCalendar .getActualMaximum (int field)
Syntax
GregorianCalendar.getActualMaximum(int field) has the following syntax.
public int getActualMaximum(int field)
Example
In the following code shows how to use GregorianCalendar.getActualMaximum(int field) method.
// w w w. java2 s.com
import java.util.*;
public class Main {
public static void main(String[] args) {
GregorianCalendar cal =
(GregorianCalendar) GregorianCalendar.getInstance();
// get actual maximum for day_of_month
int max = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
System.out.println("Actual Maximum:" + max);
// get actual maximum for YEAR
max = cal.getActualMaximum(GregorianCalendar.YEAR);
System.out.println("Actual Maximum:" + max);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »