Source code for VectorExample.java:

import java.util.*;

public class VectorExample
{
	public static void main(String args[])
	{
		// VectorExample
		Vector v = new Vector();
		String s = new String("Hello");
		v.add(s);
		v.add("Goodbye");
		System.out.println(v);
		System.out.println(v.size());
		boolean success = v.remove(s);
		System.out.println(v);
		System.out.println(success);
		System.out.println(v.size());
	}
}

Output from VectorExample.java:

[Hello, Goodbye] 2 [Goodbye] true 1

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the VectorExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR