All pastes #424123 Raw Edit

inverter

public text v1 · immutable
·published 2007-04-04 16:19 UTC
rendered paste body
/*
 * Vetor.java
 *
 * Created on 4 de Abril de 2007, 13:02
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author Fernando
 */
import java.util.Vector;
public class Vetor {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
    Vector v = new Vector();
    Vector aux = new Vector(); //Cria um vetor auxiliar
    
    v.add("primeiro");
    v.add("segundo");
    v.add("terceiro");

    int tam=v.size();//Pega o tamanho do vetor
    for (int i=tam;i=0;i--)
    {
        aux.add(v.get(i));
    }
    v=aux;
   for (int i=0; i<v.size();i++)
   {
    System.out.println(v.get(i));
   }
    
}