java.util.Calendar.hashCode()%uA0方法返回此日历对象的哈希码。
声明
以下是java.util.Calendar.hashCode()方法的声明
public int hashCode()
参数
-
NA
返回值
该方法返回此日历对象的哈希码值。
异常
-
NA
例子
下面的示例演示java.util.calendar.hashCode()方法的用法。
package com.yiibai import java.util.* public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = Calendar.getInstance() // display current calendar System.out.println("The current calendar shows: " + cal.getTime()) // get the hash code and print it int i = cal.hashCode() System.out.println("A hash code for this calendar is: " + i) } }
让我们来编译和运行上面的程序,这将产生以下结果:
The current calendar shows: Wed May 02 14:42:43 EEST 2012 A hash code for this calendar is: 53578188