为什么多次调用同一个对象的HashCode方法返回不一样

xiaoxiao2021-02-28  126

public class HashCodeDemo  { public static void main(String[] args)  { Person p = new Person(); System.out.println(p.hashCode()); Person p2 = p; System.out.println(p2.hashCode()); String str = "abc"; System.out.println(str.hashCode()); } } class Person { }
转载请注明原文地址: https://www.6miu.com/read-29823.html

最新回复(0)