Java Date Time - 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.

//from  ww  w.  ja  v a 2s.  c o m
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.