Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/10/2010, 10:21
RyoAkiyama
 
Fecha de Ingreso: octubre-2010
Mensajes: 46
Antigüedad: 13 años, 7 meses
Puntos: 1
Respuesta: ArrayList - Imprimir elemento > X

package pescados;

import java.util.ArrayList;

public class pescados {

public static void main(String[] args) {
// TODO code application logic here
ArrayList<Float> fishLenghtList = new ArrayList<Float>();
fishLenghtList.add(10.0f);
fishLenghtList.add(15.5f);
fishLenghtList.add(18.0f);
fishLenghtList.add(29.5f);
fishLenghtList.add(45.5f);
for (Float fish : fishLenghtList){
if(fish>28)
{
System.out.println("This fish' lenght is" + fish + "\n");
}
}
}
}

Prueba este codigo y me cuentas como te fue, yo lo probe y funciona bien, solo imprime 29.5 y 45.5, y si, fish realmente toma el valor conforme recorre el array list, es decir, seria 10, luego 15.5, etc.

saludos !!