Having trouble getting this for loop w/ enumerated strings to compile, I don't know what I'm missing to make it work. I prefer using for (i = 0; i < 5; i++) {} but it doesn't work well for strings. Any advice is appreciated.
import java.util.*`
public class Main {
public static void main(String args[])
{
Enumeration<String> Names;
Vector<String> cNames = new Vector();
Names.add("string1");
Names.add("string2");
Names.add("string3");
Names.add("string4");
Names.add("string5");
Names = cNames.elements();
for (Names : cNames.elements())
{
System.out.println(names);
}
}
}