Java Arrays.hashCode(char[] a)
Syntax
Arrays.hashCode(char[] a) has the following syntax.
public static int hashCode(char[] a)
Example
In the following code shows how to use Arrays.hashCode(char[] a) method.
/*ww w . j av a 2s . co m*/
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// initializing char array
char[] cval = new char[] { 'a', 'k' };
System.out.println(Arrays.hashCode(cval));
System.out.println(cval.hashCode());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »