Java Collection Tutorial - Java Arrays.hashCode(int[] a)








Syntax

Arrays.hashCode(int[] a) has the following syntax.

public static int hashCode(int[] a)

Example

In the following code shows how to use Arrays.hashCode(int[] a) method.

//from   www  .  j  a  va2s.c o  m
import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
    
    // initializing int array
    int[] ival = new int[] { 3, 5 };



    System.out.println(Arrays.hashCode(ival));
    System.out.println(ival.hashCode());
  }
}

The code above generates the following result.