GregorianCalendar class getLeastMaximum(int field)method example
Returns the lowest maximum value for the given calendar field
GregorianCalendarclass getLeastMaximum(int field) method example. This example shows you how to use getLeastMaximum(int field)method.This method Returns the lowest maximum value for the given calendar field
Here is the code:-
/**
* @Program that Returns the lowest maximum value for the given calendar field
* GetLeastMaximum.java
* Author:-RoseIndia Team
* Date:-27-May-2008
*/
import java.util.*;
public class GetLeastMaximum {
public static void main(String[] args) {
//Creating a Calendar
GregorianCalendar g = new GregorianCalendar(2004, 6, 3);
//Displays the date of the Calendar
System.out.println("Current date of the Calendar is: " + g.get(Calendar.DATE));
//Returns the lowest maximum value for the given calendar field
int i = g.getLeastMaximum(Calendar.DATE);
System.out.println("Lowest maximum value for the given calendar field is:" + i);
}
} |
Output of the program:-
Current date of the Calendar is: 3
Lowest maximum value for the given calendar field is:28 |
|