Click here to watch in Youtube :https://www.youtube.com/watch?v=4v6T8jpy6h4&list=UUhwKlOVR041tngjerWxVccwVectorExample.javaimport java.util.Vector;
/*
* Example of contains(Object o) method
*/
public class VectorExample
{
public static void main(String[] args)
{
Vector<Integer> vector = new Vector<Integer>();
vector.add(10);
vector.add(20);
vector.add(30);
System.out.println("vector : " + vector + "\n");
/*
* Returns true if this vector contains the specified element
*/
boolean isExist = vector.contains(20);
System.out.println("is '20' Exist in vector : " + isExist + "\n");
isExist = vector.contains(500);
System.out.println("is '500' Exist in vector : " + isExist);
}
}
Output vector : [10, 20, 30]
is '20' Exist in vector : true
is '500' Exist in vector : false