Home Java SCJP SCWCD Servlet Submit News Contact Us Site Map


Over 500 magazines for free (including Oracle Magazine)!

Yes all of them are FREE. You can subscribe to ALL of them.
Click here to apply today!

Home > Java > Java Articles

Java Vector Constructors

1) Vector()
Creates a new empty vector with size 10 and capacityIncrement 0.


Example
Vector v = new Vector();

Creates a new Vector object with size 10.

2) Vector (int initialCapacity)
Creates a new empty vector with the specified initial capacity and with capacityIncrement equal to 0.


Example
Vector v = new Vector(100);

Creates a new Vector with initialCapacity equals to 100 and capacityIncrement equals to 0.


3) Vector (Collection c)
Creates a new vector containing elements of the specified collection in the order returned by the Collection’s Iterator.


Example
Vector v = new Vector(myCollection);

Where myCollection is the Object of type Collection.

4) Vector (int initialCapacity, int capacityIncrement)
Creates a new empty vector with the specified initial capacity and with specified capacityIncrement.


Example
Vector v = new Vector(100,20);

Creates a new Vector with initialCapacity equals to 100 and capacityIncrement equals to 20.

<< Java Vector

Java Vector Search Elements>>

Home Java SCJP SCWCD Servlet Site map