Java-util-calendar-hashcode
提供:Dev Guides
Java.util.Calendar.hashCode()メソッド
説明
- java.util.Calendar.hashCode()*メソッドは、このカレンダーオブジェクトのハッシュコードを返します。
宣言
以下は* java.util.Calendar.hashCode()*メソッドの宣言です
public int hashCode()
パラメーター
NA
戻り値
メソッドは、このカレンダーオブジェクトのハッシュコード値を返します。
例外
NA
例
次の例は、java.util.calendar.hashCode()メソッドの使用方法を示しています。
package com.finddevguides;
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