Unless you have something else to do, just print the variable descripcion
:
for(String descripcion : listadescripcionS) {
// Opción 1:
System.out.println(descripcion);
// Opción 2:
System.out.println(String.format("Descripción:\t%s", descripcion));
}
The "style" for(T t : collection)
means, literally: "For each object of type T
within the given collection" (it is the style "for-each" ). In the case of the example that you pose in your question, what you are saying is: "For each descripcion
in the list listadescripcionS
do what is between braces" .
Now, if you need to do something else with the values saved in the list, you can pass the variable descripcion
to the method you need to execute:
for(String descripcion : listadescripcionS) {
miMetodo(descripcion);
/*
// Si tu método regresa algo y después tienes
// que hacer otra cosa con ese algo, puedes
// escribir algo como esto:
T unObjeto = miMetodo(descripcion);
// donde T es algún tipo (o clase).
// Después podrás hacer lo que sea necesario con 'unObjeto'.
*/
}