Java.lang.Character.Subset.hashCode() 方法
描述
java.lang.Character.Subset.hashCode() 方法返回标准哈希码。
声明
以下是 java.lang.Character.Subset.hashCode() 方法的声明。
public final int hashCode()
参数
NA
返回值
此方法返回此对象的哈希码值。
异常
NA
示例
下面的例子展示了 java.lang.Character.Subset.hashCode() 方法的使用。
package com.tutorialspoint; import java.lang.*; public class CharacterSubsetDemo extends Character.Subset { // constructor of super class CharacterSubsetDemo(String s) { super(s); } public static void main(String[] args) { CharacterSubsetDemo obj1 = new CharacterSubsetDemo("admin"); CharacterSubsetDemo obj2 = new CharacterSubsetDemo("webmaster"); CharacterSubsetDemo obj3 = new CharacterSubsetDemo("administrator"); // returns a hash code value int retval = obj1.hashCode(); System.out.println("Hash code of Object " + obj1 + " = " + retval); retval = obj2.hashCode(); System.out.println("Hash code of Object " + obj2 + " = " + retval); retval = obj3.hashCode(); System.out.println("Hash code of Object " + obj3 + " = " + retval); } }
让我们编译并运行上面的程序,这将产生下面的结果 −
Hash code of Object admin = 1704856573 Hash code of Object webmaster = 705927765 Hash code of Object administrator = 366712642