Vector hashCode() in Java

hashCode(): This method is available in java.util.Vector class of Java.

Syntax:

int java.util.Vector.hashCode()

This method returns the hash code value for this Vector.

Parameters: NA

Returns: the hash code value for this list.

Exceptions: NA

Approach

Java

import java.util.Vector;

public class VectorhashCode {
    public static void main(String[] args) {

        Vector<String> vector = new Vector<>();

        vector.add("Hello");
        vector.add("Java");
        vector.add("C++");
        vector.add("Program");

        System.out.println(vector.hashCode());
    }
}

Output:

-1453113038


No comments:

Post a Comment