Returns a hash code based on the contents of the specified array.The value returned by this method is the same value that would be obtained by invoking the hashCode()
method on a List containing a sequence of Integer instances representing the elements of a in the same order. If a is null, this method returns 0.
Line | Description |
---|---|
5 | Declaration and initialization of the array myArray with the values 1, 2, 3, 4 and 5. |
7 | The hashCode() Method returns a hash code based on the contents of myArray |
import java.util.Arrays;
public class ArraysMethods {
public static void main(String[] args) {
int[] myArray = { 1, 2, 3, 4, 5 };
System.out.println(Arrays.hashCode(myArray));
}
}
29615266