Click here to watch in Youtube :
https://www.youtube.com/watch?v=4v6T8jpy6h4&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
Output
https://www.youtube.com/watch?v=4v6T8jpy6h4&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
import 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); } }
vector : [10, 20, 30] is '20' Exist in vector : true is '500' Exist in vector : false
To Download VectorDemoContains Project Click the below link
https://sites.google.com/site/javaee4321/java-collections/VectorDemoContains.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment