Click here to watch on Youtube:
https://www.youtube.com/watch?v=S4-l_9ANpBM&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo_getGreatestMinimum.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo_getGreatestMinimum
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ca178d0280357a5fff33a91716acad6f25ed6390/BasicJava_2018/GregorianCalendarDemo_getGreatestMinimum/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=S4-l_9ANpBM&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo.java
import java.util.GregorianCalendar;
public class GregorianCalendarDemo
{
public static void main(String[] args)
{
GregorianCalendar cal = (GregorianCalendar) GregorianCalendar
.getInstance();
/*
* Parameters:
*
* field - the calendar field.
*
* Returns:
*
* the highest minimum value for the given calendar field.
*/
int min = cal.getGreatestMinimum(GregorianCalendar.DAY_OF_MONTH);
System.out.println("Greatest Minimum, DAY_OF_MONTH = " + min);
min = cal.getGreatestMinimum(GregorianCalendar.MONTH);
System.out.println("Greatest Minimum, MONTH = " + min);
/*
* Parameters:
*
* field - the calendar field
*
* Returns:
*
* the lowest maximum value for the given calendar field.
*/
int max = cal.getLeastMaximum(GregorianCalendar.DAY_OF_MONTH);
System.out.println("Least Maximum, DAY_OF_MONTH = " + max);
max = cal.getLeastMaximum(GregorianCalendar.MONTH);
System.out.println("Least Maximum, MONTH = " + max);
}
}
public class GregorianCalendarDemo
{
public static void main(String[] args)
{
GregorianCalendar cal = (GregorianCalendar) GregorianCalendar
.getInstance();
/*
* Parameters:
*
* field - the calendar field.
*
* Returns:
*
* the highest minimum value for the given calendar field.
*/
int min = cal.getGreatestMinimum(GregorianCalendar.DAY_OF_MONTH);
System.out.println("Greatest Minimum, DAY_OF_MONTH = " + min);
min = cal.getGreatestMinimum(GregorianCalendar.MONTH);
System.out.println("Greatest Minimum, MONTH = " + min);
/*
* Parameters:
*
* field - the calendar field
*
* Returns:
*
* the lowest maximum value for the given calendar field.
*/
int max = cal.getLeastMaximum(GregorianCalendar.DAY_OF_MONTH);
System.out.println("Least Maximum, DAY_OF_MONTH = " + max);
max = cal.getLeastMaximum(GregorianCalendar.MONTH);
System.out.println("Least Maximum, MONTH = " + max);
}
}
Output
Greatest Minimum, DAY_OF_MONTH = 1
Greatest Minimum, MONTH = 0
Least Maximum, DAY_OF_MONTH = 28
Least Maximum, MONTH = 11
Greatest Minimum, MONTH = 0
Least Maximum, DAY_OF_MONTH = 28
Least Maximum, MONTH = 11
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo_getGreatestMinimum.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo_getGreatestMinimum
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/ca178d0280357a5fff33a91716acad6f25ed6390/BasicJava_2018/GregorianCalendarDemo_getGreatestMinimum/?at=master
See also:
No comments:
Post a Comment