81
Java Vector contains() Method
The contains() method of Java Vector class is used to check the vector which is in use contains the specified element or not. It returns true if this vector contains the specified element, otherwise returns false.
Syntax:
Following is the declaration of contains() method:
Parameter:
Parameter | Description | Required/Optional |
---|---|---|
o | It is the element whose presence in this vector will be tested. | Required |
Returns:
The contains() method returns true if this vector contains the specified element, otherwise returns false.
Exceptions:
NA
Compatibility Version:
Java 1.2 and above
Example 1:
Output:
Java is present at the index 1
Example 2:
Output:
Existence: true
Next TopicJava Vector