Java Date Time - Java Calendar.hashCode()








Syntax

Calendar.hashCode() has the following syntax.

public int hashCode()

Example

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

/*from ww  w.  j  a  va 2 s  . co m*/
import java.util.Calendar;

public class Main {

   public static void main(String[] args) {

      Calendar cal = Calendar.getInstance();

      // get the hash code and print it
      int i = cal.hashCode();
      System.out.println("A hash code for this calendar is: " + i);
   }
}

The code above generates the following result.