GregorianCalendar class hashCode()method example

Generates the hash code for this GregorianCalendar object.


GregorianCalendarclass hashCode()method example. This example shows you how to use hashCode()method.This method Generates the hash code for this GregorianCalendar object.

Here is the code:-
/**
 * @Program that Generates the hash code for this GregorianCalendar object.
 * HashCode.java 
 * Author:-RoseIndia Team
 * Date:-27-May-2008
 */
import java.util.*;
public class HashCode {
public static void main(String[] args) {
//Creating a Calendar    
GregorianCalendar g=new GregorianCalendar(2004,6,3);
//Displays the date of the Calendar
System.out.println("Current date of the Calendar is: "+g.get(Calendar.DATE));
//Generates the hash code for this GregorianCalendar object.
int i=g.hashCode();
System.out.println("HashCode of the Calendar is: "+i);
    }

}

  Output of the program:-
Current date of the Calendar is: 3
HashCode of the Calendar is: -1936006810

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US