GregorianCalendar getLeastMaximum(int) in Java

getLeastMaximum(int): This method is available in java.util.GregorianCalendar class of Java.

Syntax:

int java.util.GregorianCalendar.getLeastMaximum(int field)

This method takes one argument of type int as its parameter. This method returns the lowest maximum value for the given calendar field of this GregorianCalendar instance.

Parameters: One parameter is required for this method.

field: the calendar field.

Returns: the lowest maximum value for the given calendar field.

Exceptions: NA

Approach

Java

import java.util.GregorianCalendar;

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

        GregorianCalendar cal = new GregorianCalendar();

        int field = 0;

        System.out.println(cal.getLeastMaximum(field));
    }
}

Output:

1


No comments:

Post a Comment