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