為什么o對象的hashcode值變了?此對象不是沒有進行任何操作嗎?程序1:public class Temp { public static void main(String[] args) { Object o = new Object(); int[] a = new int[5]; // System.out.println("a hashcode:"+a.hashCode()); System.out.println("o hashcode:" + o.hashCode()); }}輸出結果:o hashcode:366712642程序2:public class Temp { public static void main(String[] args) { Object o = new Object(); int[] a = new int[5]; System.out.println("a hashcode:"+a.hashCode()); System.out.println("o hashcode:" + o.hashCode()); }}輸出結果:a hashcode:366712642o hashcode:1829164700重復問題:為什么o對象的hashcode值變了?此對象不是沒有進行任何操作嗎?
添加回答
舉報
0/150
提交
取消