Java vector class example.� 

Java vector class example.� 


Posted in : Java Posted on : December 11, 2010 at 5:59 PM Comments : [ 0 ]

Java vector class example.� 

Java vector class example. 

The Vector is a growable class in java. It is available in java.util package in java. All the method of vector class is synchronized class. It is very useful, because they expand automatically when new data is added to them. It is a array of object.

The Vector class is like a container, it can holds only object. You can not store primitives data type in vector class in java. If you wants to store primitives data type in Vector class, first of all store it into an object.

Vector class extends AbstractList and implements List, RandomAccess, Cloneable, Serializable. The size of a vector increase and decrease according to the program.

Syntax of some important method of Vector class. Given below..

add(Object o) : It adds the element in the end of the Vector.

elements() : It returns an enumeration of the element.

elementAt(int index) : It returns the element at the specified index.

firstElement() : It returns the first element of the vector.

lastElement() : It returns last element.

removeElementAt(int index) : It deletes the element from the given index.

size() : It returns total number of components available in vector.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics