Java GregorianCalendar.hashCode()

Syntax

GregorianCalendar.hashCode() has the following syntax.

public int hashCode()

Example

In the following code shows how to use GregorianCalendar.hashCode() method.


// w  w  w. j ava  2 s  .c  om
import java.util.*;

public class Main {

   public static void main(String[] args) {

      GregorianCalendar cal =
              (GregorianCalendar) GregorianCalendar.getInstance();


      // print a hashcode for this calendar
      System.out.println("Hash Code:" + cal.hashCode());

   }
}

The code above generates the following result.