Home » Java programming language

Java GregorianCalendar getActualMinimum() Method with Example

GregorianCalendar Class getActualMinimum() method: Here, we are going to learn about the getActualMinimum() method of GregorianCalendar Class with its syntax and example.
Submitted by Preeti Jain, on February 15, 2020

GregorianCalendar Class getActualMinimum() method

  • getActualMinimum() method is available in java.util package.
  • getActualMinimum() method is used to get the actual minimum value that this GregorianCalendar field (fi) can hold.
  • getActualMinimum() method is a non-static method, it is accessible with class object only and if we try to access the method with class name then we will get an error.
  • getActualMinimum() method does not throw an exception at the time of returning minimum value that the given field can hold.

Syntax:

    public int getActualMinimum(int fi);

Parameter(s):

  • int fi – represents the GregorianCalendar field (fi).

Return value:

The return type of this method is int, it returns actual minimum value of the given field (fi).

Example:

// Java program to demonstrate the example 
// of int getActualMinimum(int fi) method of 
// GregorianCalendar

import java.util.*;

public class GetActualMinimumOfGregorianCalendar {
    public static void main(String[] args) {
        // Instantiating a GregorianCalendar object
        GregorianCalendar ca = (GregorianCalendar) GregorianCalendar.getInstance();

        // Display current GregorianCalendar
        System.out.println("ca: " + ca.getTime());

        // By using getActualMinimum() method is to
        // return the minimum value of the given field
        // that can hold
        int year = ca.getActualMinimum(GregorianCalendar.YEAR);
        int month = ca.getActualMinimum(GregorianCalendar.MONTH);
        int day = ca.getActualMinimum(GregorianCalendar.DATE);

        // Display Minimum value of GregorianCalendar Fields
        System.out.println("ca.getActualMinimum(GregorianCalendar.YEAR): " + year);
        System.out.println("ca.getActualMinimum(GregorianCalendar.MONTH): " + month);
        System.out.println("ca.getActualMinimum(GregorianCalendar.DATE): " + day);
    }
}

Output

ca: Sat Feb 15 08:43:25 GMT 2020
ca.getActualMinimum(GregorianCalendar.YEAR): 1
ca.getActualMinimum(GregorianCalendar.MONTH): 0
ca.getActualMinimum(GregorianCalendar.DATE): 1





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.