- package blog;
- public class HashCodeTest {
- public static void main(String[] args) {
- int b=0;
- String a="I LOVE JAVA";
- b=a.hashCode();
- System.out.println("a字符串的hash码为:"+b);
-
- String c="I";
- b=c.hashCode();
- System.out.println("c字符串的hash码为:"+b);
-
- }
- }
复制代码 a字符串的hash码为:1311688441
c字符串的hash码为:73
因此,不同长度字符串的hashcode码长度也不一样
|