Funcionalidad de un vector:
public class Beatles { public static void main () { Vector band = new Vector (); band.addElement ("Paul"); band.addElement ("Pete"); band.addElement ("John"); band.addElement ("George"); System.out.println (band); band.removeElement ("Pete"); System.out.println (band); System.out.println ("En la posición 1 está: " + band.elementAt (1)); band.insertElementAt ("Ringo", 2); System.out.println ("Tamaño de la banda: " + band.size ()); for (int i = 0; i < band.size (); i++) System.out.print ( band.elementAt (i) + " "); } }
Publicar un comentario