import java.util.Enumeration;Exécution:
import java.util.Vector;
public class Iterate_Vector_Enumeration {
public static void main(String[] args) {
Vectorvct = new Vector ();
//ajouter des éléments
vct.add("premier");
vct.add("deuxième");
vct.add("troisième");
vct.add("quatrième");
Enumerationenm = vct.elements();
while(enm.hasMoreElements()){
System.out.println(enm.nextElement());
}
}
}
premier
deuxième
troisième
quatrième
Please disable your ad blocker and refresh the window to use this website.