Remove all elements from a vector

ReturnMethodSummary
voidclear()Removes all of the elements from 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);
    
    v.clear();
    
    System.out.println(v);
    
  }
}

The output:


[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.