Calendar class hashCode()method example
Returns a hash code for this calendar.
Calendar class hashCode()method example. This example shows you how to use hashCode()method.This method Returns a hash code for this calendar.
Here is the code:-
/*
* @Program that Returns a hash code for this calendar.
* Hashcode.java
* Author:-RoseIndia Team
* Date:-23-May-2008
*/
import java.util.*;
public class Hashcode {
public static void main(String[] args) {
Calendar c= Calendar.getInstance();
//Displays the current calendar
System.out.println(" Current Date & Time is: "+c.getTime());
//Returns a hash code for this calendar.
int i=c.hashCode();
System.out.println(" Hash code of Current Date & Time is: "+i);
}
} |
Output of the program:-
Current Date & Time is: Sat May 24 12:20:35 IST 2008
Hash code of Current Date & Time is: 339031465 |
|