Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/02/2014, 13:39
SilverDante
 
Fecha de Ingreso: diciembre-2013
Mensajes: 36
Antigüedad: 10 años, 4 meses
Puntos: 1
Pregunta Respuesta: Insertar elemento creado en una clase desde otra.

Gracias por la ayuda. Pero habiéndose insertado el "animal" en el ArrayList, luego en el método para mostrar no encuentra nada.

Este es el método:

Código:
public static void mostrarAnimales(ArrayList <Animal> Bestario){
        int i=0;

        Iterator it = Bestario.iterator(); //Porque utilizar esto --> http://goo.gl/EfvDx0
        if (!it.hasNext())
            System.out.println("No Hay Animales en el registro."+"\n");
        else
         while (it.hasNext())
         {
            it.next();
            System.out.println("Animal nº: " +(i+1)                      +"\n"+
                               "Nombre:   " +Bestario.get(i).nombre    +"\n"+
                               "Pais: " +Bestario.get(i).pais +"\n"+
                               "Peso: " +Bestario.get(i).peso +"\n"+
                               "Edad: " +Bestario.get(i).edad  +"\n\n");
            i++;
         }
    }
Descargar el código:
>> http://goo.gl/gOh26l <<