개체 수는자바 : 열거의 값을 매핑하는 프로그램 아래의 그림과 같이 내가 열거를
public class Test {
public static void main(String args[]) {
Vector v = new Vector();
v.add("Three");
v.add("Four");
v.add("One");
v.add("Two");
Enumeration e = v.elements();
load(e) ; // **Passing the Enumeration .**
}
}
또한
public Student
{
String one ;
String two ;
String three ;
String four ;
}
내가 전달해야 학생 개체가 다음에 나타내는 다른 메소드의 열거.
private Data load(Enumeration rs)
{
Student stud = new Student();
while(rs.hasMoreElements())
{
// Is it possible to set the Values for the Student Object with appropiate values I mean as shown below
stud.one = One Value of Vector here
stud.two = Two Value of Vector here
stud.three = Three Value of Vector here
stud.four = Four Value of Vector here
}
}
의견을 보내주십시오. 감사합니다.
왜 '벡터'와 '열거'를 사용하고 있습니까? 'ArrayList'와'Collection'은 작업하기가 훨씬 쉽습니다. –