Javatpoint Logo
Javatpoint Logo

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:

Test it Now

Output:

Java is present at the index 1

Example 2:

Test it Now

Output:

Existence: true

Next TopicJava Vector





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA