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