Click here to watch in Youtube :
https://www.youtube.com/watch?v=TlW_3HCDNrI&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
Outputhttps://www.youtube.com/watch?v=TlW_3HCDNrI&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
import java.util.Vector; /* * Example of addElement(E obj) method */ public class VectorExample { public static void main( String[] args ) { Vector<Integer> vector = new Vector<Integer>(); vector.add(100); vector.add(200); vector.add(300); System.out.println("vector : " + vector + "\n"); /* * Adds the specified component to the end of this vector, increasing * its size by one. The capacity of this vector is increased if its size * becomes greater than its capacity. */ vector.addElement(400); System.out.println("vector : " + vector); } }
vector : [100, 200, 300] vector : [100, 200, 300, 400]
To Download VectorDemoAddElement Project Click the below link
https://sites.google.com/site/javaee4321/java-collections/VectorDemoAddElement.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment