public class Snippet {
public static void main(String[] args) {
System.out.println("buzzards".hashCode());
System.out.println("righto".hashCode());
System.out.println("buzzards".hashCode() == "righto".hashCode());
}
}/* Output:
-931102253
-931102253
true
*///:~
本文展示了一个简单的Java程序,通过使用字符串的hashCode方法来获取并比较两个字符串的哈希值,展示了hashCode方法在字符串处理中的应用。
1357

被折叠的 条评论
为什么被折叠?



