Click here to watch in Youtube :
https://www.youtube.com/watch?v=UM9wfdMMjsc&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
Output
https://www.youtube.com/watch?v=UM9wfdMMjsc&list=UUhwKlOVR041tngjerWxVccw
VectorExample.java
import java.util.Vector; /* * Example of setElementAt(E obj, int index) method. */ public class VectorExample { public static void main( String[] args ) { Vector<Integer> vector = new Vector<Integer>(); vector.add(20); vector.add(30); vector.add(40); vector.add(50); System.out.println("vector : " + vector + "\n"); /* * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is * discarded. */ vector.setElementAt(1000, 1); System.out.println("vector : " + vector + "\n"); } }
vector : [20, 30, 40, 50] vector : [20, 1000, 40, 50]
https://sites.google.com/site/javaee4321/java-collections/VectorDemoSetElementAt.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment