java.util.GregorianCalendar.hashCode()%uA0方法生成此GregorianCalendar对象的哈希代码。
声明
以下是java.util.GregorianCalendar.hashCode()方法的声明
public int hashCode()
参数
-
NA
返回值
此方法返回此对象的哈希码值。
异常
-
NA
例子
下面的示例演示java.util.GregorianCalendar.hashCode()方法的用法。
package com.yiibai import java.util.* public class GregorianCalendarDemo { public static void main(String[] args) { // create a new calendar GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance() // print the current date and time System.out.println("" + cal.getTime()) // print a hashcode for this calendar System.out.println("Hash Code:" + cal.hashCode()) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Fri May 18 13:18:55 EEST 2012 Hash Code:1360560473