Source code for ThreeStoogesExample.java:

import java.util.*;

public class ThreeStoogesExample
{
	public static void main(String args[])
	{
		// ThreeStoogesExample
		Vector stooges = new Vector();
		stooges.add("Larry");
		stooges.add("Curly");
		stooges.add("Moe");
		stooges.remove("Curly");
		stooges.add("Shemp");
		System.out.println("The " + stooges.size() + " Stooges");
		Vector actors = new Vector();
		actors.add("Bob");
		actors.add("Ted");
		actors.add("Alice");
		actors.add(stooges);
		System.out.println(actors.size());
		System.out.println(actors);
	}
}

Output from ThreeStoogesExample.java:

The 3 Stooges 4 [Bob, Ted, Alice, [Larry, Moe, Shemp]]

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the ThreeStoogesExample 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