Sun Oct 21, 2012 7:42 pm
import java.util.Iterator;
import java.util.Vector;
public class ArraysWork {
public static void main(String[] args) {
Vector vectorObject = new Vector();
String cityStrings[] = {"Newyork", "Toronto", "Delhi", "Cairo"};
for (String str : cityStrings) {
vectorObject.add(str);
}
/*
*
* Printing the content vector
*/
Iterator vectorIterator = vectorObject.iterator();
for (; vectorIterator.hasNext();) {
System.out.println(vectorIterator.next());
}
}
}
NewYork
Toronto
Delhi
Cairo
vectorObject.clear();
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.