Foros aprenderaprogramar.com
Aprender a programar => Aprender a programar desde cero => Mensaje iniciado por: Campillo en 24 de Agosto 2015, 22:05
-
Código propuesto como solución al ejercicio CU00678B del tutorial java:
import java.util.Set;
import java.util.TreeSet;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Iterator;
public class Test78
{
public static void main( String [] args ) {
System.out.println("Go");
ArrayList <Set> array = new ArrayList <Set>();
HashSet <String> hashSet = new HashSet <String>();
TreeSet <Integer> treeSet = new TreeSet <Integer>();
hashSet.add("sol");
hashSet.add("luna");
hashSet.add("saturno");
treeSet.add(2);
treeSet.add(8);
treeSet.add(5);
array.add(hashSet);
array.add(treeSet);
Iterator <Set> it = array.iterator();
while(it.hasNext()){
System.out.print(it.next());
}
}
}
-
Hola Campillo:
Estuve revisando tu ejercicio y lo veo muy bien !!
A seguir adelante entonces.