import java.util.Vector;Exécution:
public class VectorToArray {
public static void main(String[] args) {
Vector<String> vct = new Vector<String>();
//ajouter des éléments
vct.add("un");
vct.add("deux");
vct.add("trois");
vct.add("quatre");
System.out.println("Vector:");
for(String e:vct)
System.out.println(e);
String[] copyArr = new String[vct.size()];
vct.copyInto(copyArr);
System.out.println("Eléments copiés:");
for(String e:copyArr){
System.out.println(e);
}
}
}
Vector:
un
deux
trois
quatre
Eléments copiés:
un
deux
trois
quatre
Please disable your ad blocker and refresh the window to use this website.