Clone a vector

ReturnMethodSummary
Objectclone()Returns a clone of this vector.

import java.util.Vector;

public class Main{

  public static void main(String args[]) {

    Vector v = new Vector(2000);

    v.add("java2s.com");
    System.out.println(v);
    
    Object anotherV = v.clone();
    
    System.out.println(v);
    
  }
}

The output:


[java2s.com]
[java2s.com]
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.