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








Syntax

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

public static int hashCode(boolean[] a)

Example

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

//from w  w w. j av a2  s  .  c om

import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
  
    // initializing boolean array
    boolean[] bval = new boolean[] { true };
    
    System.out.println(Arrays.hashCode(bval));
    System.out.println(bval.hashCode());
   
  }
}

The code above generates the following result.