java.lang.Long.hashCode()%uA0方法返回这个Long的哈希码。结果是这个Long对象持有的原始long值的两半的异或。
声明
以下是java.lang.Long.hashCode()方法的声明
public int hashCode()
参数
-
NA
返回值
此方法返回该对象的哈希码值。
异常
-
NA
例子
下面的例子显示java.lang.Long.hashCode()方法的使用。
package com.yiibai import java.lang.* public class LongDemo { public static void main(String[] args) { Long l = new Long(65987) /* returns a hash code value for this object, equal to the primitive int value represented by this Long object */ int retval = l.hashCode() System.out.println("Value = " + retval) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Value = 65987