I have the following method that is giving me grief.
public StudentList makeSubList(MarkList markVec)
{
Vector sVec = new Vector();
Mark mark;
Student student;
Enumeration enumMark = markVec.elements();
Enumeration enumStud = studentVec.elements();
// outer loop for markVec we will compare each
// element in this against the inner loop
while( enumMark.hasMoreElements()){
String s = mark.getStudentId();
// inner loop will step through studentVec
while(enumStud.hasMoreElements()) {
String s1 = student.getStudentId();
if(s.equals (s1)) sVec.addElement(student);
student =(Student)enumStud.nextElement();
}
mark = (Mark)enumMark.nextElement();
}
return new StudentList(sVec);
}
When I try to compile this method the following error is generated
C:\AU ASSIGNMENT 2\StudentList.java:73: cannot resolve symbol
symbol : method elements ()
location: class MarkList
Enumeration enumMark = markVec.elements();
^
1 error
Can some one tell what my problem is?
02-25-2002, 10:42 AM
Paul Clapham
Re: Java Compile Problem
Your MarkList class doesn't have an elements() method. And since markVec is
a variable whose class is MarkList, the compiler doesn't know what to do
when asked to compile its elements() method.
PC2
"Glenn" <gplummer@telusplanet.net> wrote in message
news:3c7992f4$1@10.1.10.29...
>
> I have the following method that is giving me grief.
>
> public StudentList makeSubList(MarkList markVec)
> {
> Vector sVec = new Vector();
> Mark mark;
> Student student;
> Enumeration enumMark = markVec.elements();
> Enumeration enumStud = studentVec.elements();
>
> // outer loop for markVec we will compare each
> // element in this against the inner loop
>
> while( enumMark.hasMoreElements()){
>
> String s = mark.getStudentId();
> // inner loop will step through studentVec
>
> while(enumStud.hasMoreElements()) {
> String s1 = student.getStudentId();
> if(s.equals (s1)) sVec.addElement(student);
> student =(Student)enumStud.nextElement();
> }
> mark = (Mark)enumMark.nextElement();
> }
> return new StudentList(sVec);
> }
>
>
> When I try to compile this method the following error is generated
>
> C:\AU ASSIGNMENT 2\StudentList.java:73: cannot resolve symbol
> symbol : method elements ()
> location: class MarkList
> Enumeration enumMark = markVec.elements();
> ^
> 1 error
>
>
> Can some one tell what my problem is?