The answer is 1026. How did you come up with this answer Dan ?
Joined: Jul 14, 2002
oops!! i made a boo-boo... I got it now.
Joined: Sep 10, 2002
Can you explain? thank you.
Joined: Jul 02, 2002
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>
Joined: Aug 05, 2002
Hi Dan: I am trying to find an easy read on HashCode() method. Can you suggest one?