「java入門」java.util.Enumerationの使い方

1.javaコード
import java.util.Enumeration;
import java.util.Vector;

public class Enum22 {

public static void main(String[] args) {
Enumeration<String> md;
Vector<String> cft = new Vector<String>();

cft.add(“Sunday”);
cft.add(“Monday”);
cft.add(“Tuesday”);
cft.add(“Wednesday”);
cft.add(“Thursday”);
cft.add(“Friday”);
cft.add(“Saturday”);
md = cft.elements();

System.out.println(“結果下記:”);
while (md.hasMoreElements()) {
System.out.println(md.nextElement());
}

}

}

結果下記:
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

Comments are closed.