❮ Previous Next ❯

Vector

The methods available in Vector class are:

addElement(Object o);
addElement(index);
removeElement(index);
removeElements();

Constructors:

Vector v=new Vector(Collection c);

Example : VectorDemo.java:

import java.util.*;
classVectorDemo
{
public static void main(String args[])
{
Vector v=new Vector();
System.out.println(v.capacity());
for(inti=1;i<=10;i++)
{
v.addElement(i);
}
v.addElement("silan");
System.out.println(v.capacity());
System.out.println(v);
}
}
Output:

10
20
[1,2,3,4,5,6,7,8,9,10,silan]

❮ Previous Next ❯



  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved