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








Syntax

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

public static int hashCode(Object [] a)

Example

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

/* w  w  w.  jav  a2s . c o m*/

import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
       
    // initializing Object array
    Object[] ob = new Object[] { 22, 7 };


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

The code above generates the following result.