Vector Class Java

 Vector Class - 

The capability of implementing a growable array of objects is provided by the Class Vector.
 A Vector class implements the dynamic array that can grow and shrink at run time (dynamically). It resembles the implementation of Array list with a difference that Vector is synchronized .
 The Vector class implements an incremental array of objects. 
 The Vector components can be accessed using an integer index.
 The size of a Vector increases or decrease as needed to accommodate the items.
To reduce the amount of incremental reallocation, an application can increase the capacity of a Vector before inserting a large number of components.
    Each Vector tries to optimize storage management by maintaining a capacity and a capacity Increment. As components are added to a vector, the vector's storage increase in chunks the size of capacity Increment.

Example -: 

important Java.util.Iterator;
important java.util.vector;
public class Simple Vector Example {
      public static void main (String [ ] args){
     Vector v = new Vector();
 v .add("1");
 v .add("2");
v .add("3");
System.out.println 
                                                                                                         

No comments

Powered by Blogger.