Object.hashCode()
I tried below code: int[] a1 = {1, 2}; int[] a2 = {1, 2}; System.out.println(a1.hashCode()); System.out.println(a2.hashCode()); System.out.println(Arrays.hashCode(a1)); System.out.println(Arrays.hashCode(a2)); The result is: 1356652206 1419746043 994 994 The reason is because hashCode() int[] is not overwritten. It is treated as an object. Read below explanation from javaworld, we know hashCode() for Object is a mapping to memory.… Read More »