Originally posted by Ray Chang: Can you explain? thank you.
If you would like to know how the hash code is calculated then just move the print statement into the hashCode method.
A good hashcode calculation for an array will use the value of each element of the array. An even better hashcode method for an array will also depend on the position of each value in the array. The following is an example of a hashcode method that does not produce unique hashcodes for arrays that contain the same set of elements in different orders.
The result is "6,6,6". A better hashCode method produces unique values when the position of the array elements is changed.
The result is "1026,2016,2946".
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>