Get element from vector

ReturnMethodSummary
EelementAt(int index)Returns the component at the specified index.
EfirstElement()Returns the first component (the item at index 0) of this vector.
Eget(int index)Returns the element at the specified position in this Vector.
ElastElement()Returns the last component of the vector.

import java.util.Arrays;
import java.util.Enumeration;
import java.util.Vector;

public class Main{

  public static void main(String args[]) {

    Vector v = new Vector();

    v.add("java2s.com 1");
    v.add("java2s.com 2");
    v.add("java2s.com 3");
    System.out.println(v.elementAt(2));
  }
}

The output:


java2s.com 3
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.