Java Vector.remove(Object o)
Syntax
Vector.remove(Object o) has the following syntax.
public boolean remove(Object o)
Example
In the following code shows how to use Vector.remove(Object o) method.
//from w w w. j ava2 s. c o m
import java.util.Vector;
public class Main {
public static void main(String[] args) {
// create an empty Vector vec with an initial capacity of 6
Vector vec = new Vector (6);
vec.add(33);
vec.add(34);
vec.add(22);
vec.add(11);
vec.add(22);
vec.add(12);
// let us remove the 1st element
System.out.println("Removed element: "+vec.remove((Integer)22));
System.out.println(vec);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »