Java GregorianCalendar - hashCode() Method
The java.util.GregorianCalendar.hashCode() method returns the hash code for this GregorianCalendar object.
Syntax
public int hashCode()
Parameters
No parameter is required.
Return Value
Returns a hash code value for this object.
Exception
NA
Example:
In the example below, the java.util.GregorianCalendar.hashCode() method returns the hash code for the given GregorianCalendar object.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating a Calendar object with specified date GregorianCalendar Cal = new GregorianCalendar(2015, 10, 25); //printing the Calendar System.out.println("The Calendar is: " + Cal.getTime()); //Printing the hashCode of the Calendar System.out.println("The hashCode is: " + Cal.hashCode()); } }
The output of the above code will be:
The Calendar is: Wed Nov 25 00:00:00 UTC 2015 The hashCode is: 1006125450
❮ Java.util - GregorianCalendar