DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Glenn Guest

    Java Compile Problem


    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?

  2. #2
    Paul Clapham Guest

    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?




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links